Example #1
0
        public virtual IUserClaimState ToUserClaimState()
        {
            var state = new UserClaimState(true);

            if (this.ClaimId != null && this.ClaimId.HasValue)
            {
                state.ClaimId = this.ClaimId.Value;
            }
            state.ClaimType  = this.ClaimType;
            state.ClaimValue = this.ClaimValue;
            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);
        }
Example #2
0
        public virtual IUserClaimState Get(int claimId, bool forCreation, bool nullAllowed)
        {
            UserClaimId globalId = new UserClaimId(_userState.UserId, claimId);

            if (_loadedUserClaimStates.ContainsKey(globalId))
            {
                return(_loadedUserClaimStates[globalId]);
            }
            if (forCreation || ForReapplying)
            {
                var state = new UserClaimState(ForReapplying);
                state.UserClaimId = globalId;
                _loadedUserClaimStates.Add(globalId, state);
                return(state);
            }
            else
            {
                var state = UserClaimStateDao.Get(globalId, nullAllowed);
                if (state != null)
                {
                    _loadedUserClaimStates.Add(globalId, state);
                }
                return(state);
            }
        }
Example #3
0
 public static CreateUserClaim ToCreateUserClaim(this UserClaimState state)
 {
     return(state.ToCreateUserClaim <CreateUserClaim>());
 }
Example #4
0
 public static MergePatchUserClaim ToMergePatchUserClaim(this UserClaimState state)
 {
     return(state.ToMergePatchUserClaim <MergePatchUserClaim>());
 }
Example #5
0
 public static RemoveUserClaim ToRemoveUserClaim(this UserClaimState state)
 {
     return(state.ToRemoveUserClaim <RemoveUserClaim>());
 }
Example #6
0
 public static IUserClaimCommand ToCreateOrMergePatchUserClaim(this UserClaimState state)
 {
     return(state.ToCreateOrMergePatchUserClaim <CreateUserClaim, MergePatchUserClaim>());
 }