Exemple #1
0
 public Privilege(MasterEnum master, int masterValue, AccessEnum access, int accessValue)
 {
     Master      = master.ToString();
     MasterValue = masterValue;
     Access      = access.ToString();
     AccessValue = accessValue;
 }
 public InterfaceGenerator(AccessEnum access, string typeText,
     IMethodSignatureGenerator methodSigGenerator, IPropertyGenerator propertyGenerator)
 {
     Access = access;
     TypeText = typeText;
     _methodSignatureGenerator = methodSigGenerator as MethodSignatureGenerator;
     _propertyGenerator = propertyGenerator as PropertyGenerator;
 }
Exemple #3
0
 public string GenerateTest(Test test, string path, AccessEnum access)
 {
     var stringBuilder = new StringBuilder();
     Access = access;
     var statementList = test.StatementList;
     stringBuilder = _methodGenerator.Generate(statementList, stringBuilder);
     return stringBuilder.ToString();
 }
Exemple #4
0
        /*****************************************/
        /* helper APIs for the Admin Controller  */
        /*****************************************/

        private bool HasAccessLevel(AccessEnum accessLevel)
        {
            if (User?.IsAuthenticated() == null || !(bool)User?.IsAuthenticated())
            {
                return(false);
            }

            var identityUser = _users.FindByIdAsync(User.Identity.GetSubjectId(), new CancellationToken()).Result;

            var coreUser = _readOnlyRepository.GetById <CoreUser, Guid>(Guid.Parse(identityUser.Id));

            return(coreUser.Access >= accessLevel);
        }
Exemple #5
0
 public GroupPermissionEntry(AccessEnum access, Group group)
     : base(access)
 {
     _group = group;
 }
Exemple #6
0
 public UserPermissionEntry(AccessEnum access, User user)
     : base(access)
 {
     _user = user;
 }
Exemple #7
0
 public PermissionEntry(AccessEnum access)
 {
     _access = access;
 }
Exemple #8
0
 /// <summary>
 /// 获取AccessValue的列表
 /// </summary>
 /// <param name="query"></param>
 /// <param name="master">主体对象类型(角色或者用户)</param>
 /// <param name="access">领域对象(菜单或者按钮)</param>
 /// <param name="masterValues">主体对象Id</param>
 /// <returns></returns>
 public static List <int> GetAccessValueList(this IQueryable <Privilege> query, MasterEnum master, AccessEnum access, params int [] masterValues)
 {
     return(Get(query, master, access, masterValues).Select(s => s.AccessValue).ToList());
 }
Exemple #9
0
 void HasGlobalAccess([In][Out] ref AccessEnum accessEnum)
 {
     //TODO I know this is possible but not enough about attributes at the moment to make this work
 }
 public PropertyGenerator(AccessEnum access, string propertyText)
 {
     Access = access;
     PropertyText = propertyText;
 }
Exemple #11
0
 public MetaPermissionEntry(AccessEnum access, string id)
     : base(access)
 {
     _id = id;
 }
Exemple #12
0
 public MetaPermissionEntry(AccessEnum access, string id)
     : base(access)
 {
     _id = id;
 }
Exemple #13
0
 public ExternUserPermissionEntry(AccessEnum access, string externalUserId)
     : base(access)
 {
     _externalUserId = externalUserId;
 }
 public MethodSignatureGenerator(AccessEnum access, string methodText)
 {
     Access = access;
     MethodText = methodText;
 }
Exemple #15
0
 public PermissionEntry(AccessEnum access)
 {
     _access = access;
 }
Exemple #16
0
 public ExternUserPermissionEntry(AccessEnum access, string externalUserId)
     : base(access)
 {
     _externalUserId = externalUserId;
 }
Exemple #17
0
 public UserPermissionEntry(AccessEnum access, User user)
     : base(access)
 {
     _user = user;
 }
Exemple #18
0
 public ExternGroupPermissionEntry(AccessEnum access, string externalGroupId)
     : base(access)
 {
     _externalGroupId = externalGroupId;
 }
Exemple #19
0
 public ExternGroupPermissionEntry(AccessEnum access, string externalGroupId)
     : base(access)
 {
     _externalGroupId = externalGroupId;
 }
Exemple #20
0
 /// <summary>
 /// 根据权限对象(Master)及功能对象(Access)获取Privilege的列表
 /// </summary>
 /// <param name="query"></param>
 /// <param name="master">主体对象类型(角色或者用户)</param>
 /// <param name="access">领域对象(菜单或者按钮)</param>
 /// <param name="masterValues">主体对象Id</param>
 /// <returns></returns>
 public static IQueryable <Privilege> Get(this IQueryable <Privilege> query, MasterEnum master, AccessEnum access, params int[] masterValues)
 {
     return(query.Where(x => x.Master == master.ToString() && x.Access == access.ToString() && masterValues.Contains(x.MasterValue)));
 }
 /// <summary>
 /// Generates an authorization URL based on the requestToken , requiredAccess and requiredPermissions
 /// </summary>
 public static string GetAuthorizationURL(Token requestToken, AccessEnum requiredAccess, PermissionsEnum requiredPermissions)
 {
     return(string.Format("{0}?oauth_token={1}&Access={2}&Permissions={3}", authorizationUrl, requestToken.id, requiredAccess, requiredPermissions));
 }
Exemple #22
0
 public GroupPermissionEntry(AccessEnum access, Group group)
     : base(access)
 {
     _group = group;
 }