/// <summary> /// Initializes a new instance of the <see cref="CreateLockPermissionCommandValidator" /> class. /// </summary> /// <param name="roleLookup">The role lookup.</param> /// <param name="permissionLookup">The permission lookup.</param> public CreateLockPermissionCommandValidator( IUserRepository userRepository, IRoleLookup roleLookup, IPermissionLookup permissionLookup) { this.userRepository = userRepository; this.roleLookup = roleLookup; this.permissionLookup = permissionLookup; RuleFor(model => model.LockId) .NotEmpty().WithMessage("LockId is required"); RuleFor(model => model.Permission) .NotEmpty().WithMessage("Permission is required"); RuleFor(model => model.UserName) .Must((model, field) => { if (String.IsNullOrEmpty(model.Role)) { return(!String.IsNullOrEmpty(field)); } return(true); }).WithMessage("Either User or Role is required"); RuleFor(model => model.Role) .Must((model, field) => { if (String.IsNullOrEmpty(model.UserName)) { return(!String.IsNullOrEmpty(field)); } return(true); }).WithMessage("Either Roles or User is required"); }
/// <summary> /// Initializes a new instance of the <see cref="GetLockQueryObjectPermissionEvaluator" /> class. /// </summary> /// <param name="executionContext">The execution context.</param> /// <param name="lockRepository">The lock repository.</param> public GetLockQueryObjectPermissionEvaluator( IExecutionContext executionContext, IPermissionLookup permissionLookup, IRoleLookup roleLookup, ILockRepository lockRepository) { this.executionContext = executionContext; this.permissionLookup = permissionLookup; this.roleLookup = roleLookup; this.lockRepository = lockRepository; }
/// <summary> /// Initializes a new instance of the <see cref="ChangeLockStatusObjectPermissionEvaluator"/> class. /// </summary> /// <param name="lockRepository">The lock repository.</param> public ChangeLockStatusObjectPermissionEvaluator( ILockRepository lockRepository, IPermissionLookup permissionLookup, IRoleLookup roleLookup, IExecutionContext executionContext) { this.lockRepository = lockRepository; this.permissionLookup = permissionLookup; this.roleLookup = roleLookup; this.executionContext = executionContext; }
/// <summary> /// Initializes a new instance of the <see cref="CreateLockPermissionCommandHandler" /> class. /// </summary> /// <param name="lockRepository">The lock repository.</param> /// <param name="userRepository">The user repository.</param> /// <param name="roleLookup">The role lookup.</param> /// <param name="permissionLookup">The permission lookup.</param> /// <param name="mapper">The mapper.</param> public CreateLockPermissionCommandHandler( ILockRepository lockRepository, IUserRepository userRepository, IRoleLookup roleLookup, IPermissionLookup permissionLookup, IMapper mapper) { this.lockRepository = lockRepository; this.userRepository = userRepository; this.roleLookup = roleLookup; this.permissionLookup = permissionLookup; this.mapper = mapper; }
/// <summary> /// Initializes a new instance of the <see cref="GroupPermissionEvaluator"/> class. /// </summary> /// <param name="executionContext">The execution context.</param> public GroupPermissionEvaluator( IExecutionContext executionContext, IPermissionPolicyRepository permissionPolicyRepository, IRoleLookup roleLookup, IPermissionLookup permissionLookup, IPermissionGroupLookup permissionGroupLookup) { this.executionContext = executionContext; this.permissionPolicyRepository = permissionPolicyRepository; this.roleLookup = roleLookup; this.permissionLookup = permissionLookup; this.permissionGroupLookup = permissionGroupLookup; }
/// <summary> /// Initializes a new instance of the <see cref="RegisterUserCommandHandler" /> class. /// </summary> /// <param name="userRepository">The user repository.</param> /// <param name="roleLookup">The role lookup.</param> /// <param name="mapper">The mapper.</param> public RegisterUserCommandHandler(IUserRepository userRepository, IRoleLookup roleLookup, IMapper mapper) { this.userRepository = userRepository; this.roleLookup = roleLookup; this.mapper = mapper; }