示例#1
0
        public override Task <PermissionGrantResult> CheckAsync(PermissionValueCheckContext context)
        {
            var permissions = MapTenancyManagementPermissions.GetAll();

            if (permissions.Contains(context.Permission.Name))
            {
                return(Task.FromResult(PermissionGrantResult.Granted));
            }
            return(Task.FromResult(PermissionGrantResult.Prohibited));
        }
示例#2
0
        public override Task <MultiplePermissionGrantResult> CheckAsync(PermissionValuesCheckContext context)
        {
            var permissions = MapTenancyManagementPermissions.GetAll();
            var result      = new MultiplePermissionGrantResult();

            foreach (var permissionDefinition in context.Permissions)
            {
                if (permissions.Contains(permissionDefinition.Name))
                {
                    result.Result.Add(permissionDefinition.Name, PermissionGrantResult.Granted);
                }
                else
                {
                    result.Result.Add(permissionDefinition.Name, PermissionGrantResult.Prohibited);
                }
            }
            return(Task.FromResult(result));
        }