本文整理汇总了C#中Rock.Model.PersonService.IsAuthorized方法的典型用法代码示例。如果您正苦于以下问题:C# PersonService.IsAuthorized方法的具体用法?C# PersonService.IsAuthorized怎么用?C# PersonService.IsAuthorized使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rock.Model.PersonService
的用法示例。
在下文中一共展示了PersonService.IsAuthorized方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowDetail
/// <summary>
/// Shows the detail.
/// </summary>
/// <param name="itemKey">The item key.</param>
/// <param name="itemKeyValue">The item key value.</param>
public void ShowDetail( string itemKey, int itemKeyValue )
{
var rockContext = new RockContext();
pnlDetails.Visible = false;
if ( !itemKey.Equals( "businessId" ) )
{
return;
}
bool editAllowed = true;
Person business = null; // A business is a person
if ( !itemKeyValue.Equals( 0 ) )
{
business = new PersonService( rockContext ).Get( itemKeyValue );
editAllowed = business.IsAuthorized( Authorization.EDIT, CurrentPerson );
}
else
{
business = new Person { Id = 0 };
}
if ( business == null )
{
return;
}
pnlDetails.Visible = true;
hfBusinessId.Value = business.Id.ToString();
bool readOnly = false;
nbEditModeMessage.Text = string.Empty;
if ( !editAllowed || !IsUserAuthorized( Authorization.EDIT ) )
{
readOnly = true;
nbEditModeMessage.Text = EditModeMessage.ReadOnlyEditActionNotAllowed( Person.FriendlyTypeName );
}
if ( readOnly )
{
ShowSummary( business );
}
else
{
if ( business.Id > 0 )
{
ShowSummary( business );
}
else
{
ShowEditDetails( business );
}
}
BindContactListGrid( business );
}