public ValidateApiUserRoleAttributeImpl(ILoggerFactory loggerFactory,
                                         IUserManagment userManagment,
                                         EUserManagmentRole AllowRole)
 {
     _logger        = loggerFactory.CreateLogger <ValidateApiUserRoleAttributeImpl>();
     _userManagment = userManagment;
     _allowRole     = AllowRole;
 }
示例#2
0
        public bool CanExecute(EUserManagmentRole requestedRole)
        {
            if (!IsLogged())
            {
                return(false);
            }

            if (IsAdmin())
            {
                return(true);
            }
            //if (User.Role == EUserManagmentRole.ReadAndWrite) return true;

            return(User.Role == requestedRole);
        }
 public ValidateApiUserRoleAttribute(EUserManagmentRole AllowRole) : base(typeof(ValidateApiUserRoleAttributeImpl))
 {
     Arguments = new object[] { AllowRole };
 }