예제 #1
0
 /// <summary>
 /// Define a user actor for a <see cref="ISecurable">securable</see>
 /// </summary>
 /// <param name="securable"><see cref="ISecurable"/> to secure</param>
 /// <returns>The <see cref="UserSecurityActor"/></returns>
 public static UserSecurityActor User(this ISecurable securable)
 {
     var actor = new UserSecurityActor();
     securable.AddActor(actor);
     return actor;
 }
예제 #2
0
파일: RoleRule.cs 프로젝트: csuffyy/Bifrost
 /// <summary>
 /// Initializes a new instance of <see cref="RoleRule"/>
 /// </summary>
 /// <param name="userToAuthorize">The <see cref="UserSecurityActor" /> to check the role against.</param>
 /// <param name="role">The role to check for</param>
 public RoleRule(UserSecurityActor userToAuthorize, string role)
 {
     _userToAuthorize = userToAuthorize;
     Role             = role;
 }
예제 #3
0
파일: RoleRule.cs 프로젝트: JoB70/Bifrost
 /// <summary>
 /// Initializes a new instance of <see cref="RoleRule"/>
 /// </summary>
 /// <param name="userToAuthorize">The <see cref="UserSecurityActor" /> to check the role against.</param>
 /// <param name="role">The role to check for</param>
 public RoleRule(UserSecurityActor userToAuthorize, string role)
 {
     _userToAuthorize = userToAuthorize;
     Role = role;
 }
 /// <summary>
 /// Declares that the <see cref="UserSecurityActor"/> must be in a specific role
 /// </summary>
 /// <param name="securityActor"><see cref="UserSecurityActor"/> to declare it for</param>
 /// <param name="role">Role</param>
 /// <returns><see cref="UserSecurityActor"/> to continue the chain with</returns>
 public static UserSecurityActor MustBeInRole(this UserSecurityActor securityActor, string role)
 {
     securityActor.AddRule(new RoleRule(securityActor, role));
     return(securityActor);
 }
예제 #5
0
 /// <summary>
 /// Define a user actor for a <see cref="ISecurable">securable</see>
 /// </summary>
 /// <param name="securable"><see cref="ISecurable"/> to secure</param>
 /// <returns>The <see cref="UserSecurityActor"/></returns>
 public static UserSecurityActor User(this ISecurable securable)
 {
     var actor = new UserSecurityActor(Configure.Instance.Container.Get<ICanResolvePrincipal>());
     securable.AddActor(actor);
     return actor;
 }