Exemplo n.º 1
0
        public override Task <PermissionGrantResult> CheckAsync(PermissionValueCheckContext context)
        {
            var permissions = FileStoringManagementPermissions.GetAll();

            if (permissions.Contains(context.Permission.Name))
            {
                return(Task.FromResult(PermissionGrantResult.Granted));
            }
            return(Task.FromResult(PermissionGrantResult.Prohibited));
        }
Exemplo n.º 2
0
        public override Task <MultiplePermissionGrantResult> CheckAsync(PermissionValuesCheckContext context)
        {
            var permissions = FileStoringManagementPermissions.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));
        }