예제 #1
0
        public virtual IUserPermissionState Get(string permissionId, bool forCreation, bool nullAllowed)
        {
            UserPermissionId globalId = new UserPermissionId(_userState.UserId, permissionId);

            if (_loadedUserPermissionStates.ContainsKey(globalId))
            {
                return(_loadedUserPermissionStates[globalId]);
            }
            if (forCreation || ForReapplying)
            {
                var state = new UserPermissionState(ForReapplying);
                state.UserPermissionId = globalId;
                _loadedUserPermissionStates.Add(globalId, state);
                return(state);
            }
            else
            {
                var state = UserPermissionStateDao.Get(globalId, nullAllowed);
                if (state != null)
                {
                    _loadedUserPermissionStates.Add(globalId, state);
                }
                return(state);
            }
        }
예제 #2
0
        public virtual IUserPermissionState ToUserPermissionState()
        {
            var state = new UserPermissionState(true);

            state.PermissionId = this.PermissionId;
            if (this.Active != null && this.Active.HasValue)
            {
                state.Active = this.Active.Value;
            }
            if (this.Version != null && this.Version.HasValue)
            {
                state.Version = this.Version.Value;
            }
            state.UserId    = this.UserId;
            state.CreatedBy = this.CreatedBy;
            if (this.CreatedAt != null && this.CreatedAt.HasValue)
            {
                state.CreatedAt = this.CreatedAt.Value;
            }
            state.UpdatedBy = this.UpdatedBy;
            if (this.UpdatedAt != null && this.UpdatedAt.HasValue)
            {
                state.UpdatedAt = this.UpdatedAt.Value;
            }

            return(state);
        }
예제 #3
0
 public static CreateUserPermission ToCreateUserPermission(this UserPermissionState state)
 {
     return(state.ToCreateUserPermission <CreateUserPermission>());
 }
예제 #4
0
 public static MergePatchUserPermission ToMergePatchUserPermission(this UserPermissionState state)
 {
     return(state.ToMergePatchUserPermission <MergePatchUserPermission>());
 }
예제 #5
0
 public static RemoveUserPermission ToRemoveUserPermission(this UserPermissionState state)
 {
     return(state.ToRemoveUserPermission <RemoveUserPermission>());
 }
예제 #6
0
 public static IUserPermissionCommand ToCreateOrMergePatchUserPermission(this UserPermissionState state)
 {
     return(state.ToCreateOrMergePatchUserPermission <CreateUserPermission, MergePatchUserPermission>());
 }