本文整理汇总了C#中Rock.Model.GroupTypeService.IsAuthorized方法的典型用法代码示例。如果您正苦于以下问题:C# GroupTypeService.IsAuthorized方法的具体用法?C# GroupTypeService.IsAuthorized怎么用?C# GroupTypeService.IsAuthorized使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rock.Model.GroupTypeService
的用法示例。
在下文中一共展示了GroupTypeService.IsAuthorized方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowDetail
/// <summary>
/// Shows the edit.
/// </summary>
/// <param name="itemKey">The item key.</param>
/// <param name="itemKeyValue">The item key value.</param>
public void ShowDetail( string itemKey, int itemKeyValue )
{
pnlDetails.Visible = false;
if ( !itemKey.Equals( "groupTypeId" ) )
{
return;
}
bool editAllowed = true;
GroupType groupType = null;
if ( !itemKeyValue.Equals( 0 ) )
{
groupType = new GroupTypeService( new RockContext() ).Get( itemKeyValue );
editAllowed = groupType.IsAuthorized( Authorization.EDIT, CurrentPerson );
}
else
{
groupType = new GroupType { Id = 0, ShowInGroupList = true, GroupTerm = "Group", GroupMemberTerm = "Member" };
groupType.ChildGroupTypes = new List<GroupType>();
groupType.LocationTypes = new List<GroupTypeLocationType>();
Guid defaultRoleGuid = Guid.NewGuid();
var memberRole = new GroupTypeRole { Guid = defaultRoleGuid, Name = "Member" };
groupType.Roles.Add( memberRole );
groupType.DefaultGroupRole = memberRole;
groupType.LocationSelectionMode = GroupLocationPickerMode.None;
}
if ( groupType == null )
{
return;
}
DefaultRoleGuid = groupType.DefaultGroupRole != null ? groupType.DefaultGroupRole.Guid : Guid.Empty;
pnlDetails.Visible = true;
hfGroupTypeId.Value = groupType.Id.ToString();
bool readOnly = false;
nbEditModeMessage.Text = string.Empty;
if ( !editAllowed || !IsUserAuthorized( Authorization.EDIT ) )
{
readOnly = true;
nbEditModeMessage.Text = EditModeMessage.ReadOnlyEditActionNotAllowed( GroupType.FriendlyTypeName );
}
if ( groupType.IsSystem )
{
nbEditModeMessage.Text = EditModeMessage.System( GroupType.FriendlyTypeName );
}
if ( readOnly )
{
ShowReadonlyDetails( groupType );
}
else
{
ShowEditDetails( groupType );
}
}
示例2: ShowGroupTypeEditDetails
/// <summary>
/// Shows the group type edit details.
/// </summary>
/// <param name="groupType">Type of the group.</param>
/// <param name="group">The group.</param>
/// <param name="setValues">if set to <c>true</c> [set values].</param>
private void ShowGroupTypeEditDetails( GroupTypeCache groupType, Group group, bool setValues )
{
if ( group != null )
{
// Save value to viewstate for use later when binding location grid
AllowMultipleLocations = groupType != null && groupType.AllowMultipleLocations;
// show/hide group sync panel based on permissions from the group type
if ( group.GroupTypeId != 0 )
{
using ( var rockContext = new RockContext() )
{
GroupType selectedGroupType = new GroupTypeService( rockContext ).Get( group.GroupTypeId );
if ( selectedGroupType != null )
{
wpGroupSync.Visible = selectedGroupType.IsAuthorized( Authorization.ADMINISTRATE, CurrentPerson );
}
}
}
if ( groupType != null && groupType.LocationSelectionMode != GroupLocationPickerMode.None )
{
wpMeetingDetails.Visible = true;
gLocations.Visible = true;
BindLocationsGrid();
}
else
{
wpMeetingDetails.Visible = pnlSchedule.Visible;
gLocations.Visible = false;
}
gLocations.Columns[2].Visible = groupType != null && ( groupType.EnableLocationSchedules ?? false );
spSchedules.Visible = groupType != null && ( groupType.EnableLocationSchedules ?? false );
phGroupAttributes.Controls.Clear();
group.LoadAttributes();
if ( group.Attributes != null && group.Attributes.Any() )
{
wpGroupAttributes.Visible = true;
Rock.Attribute.Helper.AddEditControls( group, phGroupAttributes, setValues, BlockValidationGroup );
}
else
{
wpGroupAttributes.Visible = false;
}
}
}