public MyAuthRule( AuthRule rule ) : base(rule.Id, rule.EntityId, rule.AllowOrDeny, rule.SpecialRole, rule.PersonId, rule.GroupId, rule.Order) { }
/// <summary> /// Adds the parent rules. /// </summary> /// <param name="authService">The authentication service.</param> /// <param name="itemRules">The item rules.</param> /// <param name="parentRules">The parent rules.</param> /// <param name="parent">The parent.</param> /// <param name="action">The action.</param> /// <param name="recurse">if set to <c>true</c> [recurse].</param> private void AddParentRules( AuthService authService, List<AuthRule> itemRules, List<MyAuthRule> parentRules, ISecured parent, string action, bool recurse ) { if ( parent != null ) { var entityType = Rock.Web.Cache.EntityTypeCache.Read( parent.TypeId ); foreach ( var auth in authService.GetAuths( parent.TypeId, parent.Id, action ) ) { var rule = new AuthRule( auth ); if ( !itemRules.Exists( r => r.SpecialRole == rule.SpecialRole && r.PersonId == rule.PersonId && r.GroupId == rule.GroupId ) && !parentRules.Exists( r => r.AuthRule.SpecialRole == rule.SpecialRole && r.AuthRule.PersonId == rule.PersonId && r.AuthRule.GroupId == rule.GroupId ) ) { var myRule = new MyAuthRule( rule ); myRule.EntityTitle = string.Format( "{0} <small>({1})</small>", parent.ToString(), entityType.FriendlyName ?? entityType.Name ).TrimStart(); parentRules.Add( myRule ); } } if ( recurse ) { AddParentRules( authService, itemRules, parentRules, parent.ParentAuthority, action, true ); } } }
/// <summary> /// Initializes a new instance of the <see cref="AuthEntityRule"/> class. /// </summary> /// <param name="auth">The authentication.</param> public AuthEntityRule( Auth auth ) { EntityTypeId = auth.EntityTypeId; Action = auth.Action; AuthRule = new AuthRule( auth ); }
/// <summary> /// Initializes a new instance of the <see cref="MyAuthRule"/> class. /// </summary> /// <param name="rule">The rule.</param> public MyAuthRule( AuthRule rule ) { Id = rule.Id; AuthRule = rule; }
/// <summary> /// Initializes a new instance of the <see cref="AuthEntityRule"/> class. /// </summary> /// <param name="id">The identifier.</param> /// <param name="entityTypeId">The entity type identifier.</param> /// <param name="action">The action.</param> /// <param name="entityId">The entity identifier.</param> /// <param name="allowOrDeny">The allow or deny.</param> /// <param name="specialRole">The special role.</param> /// <param name="personId">The person identifier.</param> /// <param name="personAliasId">The person alias identifier.</param> /// <param name="groupId">The group identifier.</param> /// <param name="order">The order.</param> public AuthEntityRule( int id, int entityTypeId, string action, int? entityId, string allowOrDeny, SpecialRole specialRole, int? personId, int? personAliasId, int? groupId, int order ) { EntityTypeId = entityTypeId; Action = action; AuthRule = new AuthRule( id, entityId, allowOrDeny, specialRole, personId, personAliasId, groupId, order ); }