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); } }
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); }
public static CreateUserPermission ToCreateUserPermission(this UserPermissionState state) { return(state.ToCreateUserPermission <CreateUserPermission>()); }
public static MergePatchUserPermission ToMergePatchUserPermission(this UserPermissionState state) { return(state.ToMergePatchUserPermission <MergePatchUserPermission>()); }
public static RemoveUserPermission ToRemoveUserPermission(this UserPermissionState state) { return(state.ToRemoveUserPermission <RemoveUserPermission>()); }
public static IUserPermissionCommand ToCreateOrMergePatchUserPermission(this UserPermissionState state) { return(state.ToCreateOrMergePatchUserPermission <CreateUserPermission, MergePatchUserPermission>()); }