Ejemplo n.º 1
0
 public async Task <PolicyResult> Authorize(RemoveAdminCommand action)
 {
     if (await roleService.IsUserAdmin(action.User.Username))
     {
         return(PolicyResult.Authorized());
     }
     else
     {
         return(PolicyResult.Unauthorized());
     }
 }
Ejemplo n.º 2
0
#pragma warning disable 1998
        #region Publics
        public async Task <PolicyResult> Authorize(UserAlterCommand action)
        {
            if (action.Username == action.User.Username)
            {
                return(PolicyResult.Authorized());
            }
            else
            {
                return(PolicyResult.Unauthorized());
            }
        }
Ejemplo n.º 3
0
 public async Task <PolicyResult> Authorize(RemoveModeratorFromSpaceCommand action)
 {
     if (await roleService.IsUserModerator(action.User.Username, action.Space))
     {
         return(PolicyResult.Authorized());
     }
     else
     {
         return(PolicyResult.Unauthorized());
     }
 }
Ejemplo n.º 4
0
        public async Task <PolicyResult> Authorize(SpaceAlterCommand action)
        {
            if (await roleService.IsUserAdmin(action.User.Username))
            {
                return(PolicyResult.Authorized());
            }

            if (await roleService.IsUserModerator(action.User.Username, action.Space))
            {
                return(PolicyResult.Authorized());
            }

            return(PolicyResult.Unauthorized());
        }
Ejemplo n.º 5
0
 public AuthorizationError(PolicyResult result) : base(result.Failure ?? "Unauthorized")
 {
 }