private void AuthorizeJob(IPersistenceManager pm, Guid jobId, DT.Permission requiredPermission)
        {
            var requiredPermissionEntity = requiredPermission.ToEntity();

            DA.Permission permission = GetPermissionForJob(pm, jobId, UserManager.CurrentUserId);
            if (permission == Permission.NotAllowed ||
                ((permission != requiredPermissionEntity) && requiredPermissionEntity == Permission.Full))
            {
                throw new SecurityException(NOT_AUTHORIZED);
            }
        }
Пример #2
0
        public static DT.Permission ToDto(this DA.Permission source)
        {
            switch (source)
            {
            case DA.Permission.Full: return(DT.Permission.Full);

            case DA.Permission.NotAllowed: return(DT.Permission.NotAllowed);

            case DA.Permission.Read: return(DT.Permission.Read);

            default: return(DT.Permission.NotAllowed);
            }
        }
Пример #3
0
 public static DT.Permission ToDto(DB.Permission source)
 {
     if (source == DB.Permission.Full)
     {
         return(Permission.Full);
     }
     else if (source == DB.Permission.NotAllowed)
     {
         return(Permission.NotAllowed);
     }
     else if (source == DB.Permission.Read)
     {
         return(Permission.Read);
     }
     else
     {
         return(Permission.NotAllowed);
     }
 }