Example #1
0
        public async Task OpenAsync(string providerName, string providerKey, string entityDisplayName = null)
        {
            _providerName = providerName;
            _providerKey  = providerKey;

            var result = await PermissionAppService.GetAsync(_providerName, _providerKey);

            _entityDisplayName = entityDisplayName ?? result.EntityDisplayName;
            _groups            = result.Groups;

            _grantedPermissionCount    = 0;
            _notGrantedPermissionCount = 0;
            foreach (var permission in _groups.SelectMany(x => x.Permissions))
            {
                if (permission.IsGranted && permission.GrantedProviders.All(x => x.ProviderName != _providerName))
                {
                    _disabledPermissions.Add(permission);
                    continue;
                }

                if (permission.IsGranted)
                {
                    _grantedPermissionCount++;
                }
                else
                {
                    _notGrantedPermissionCount++;
                }
            }

            _selectedTabName = GetNormalizedGroupName(_groups.First().Name);

            _modal.Show();
        }
Example #2
0
    public virtual async Task <IActionResult> OnGetAsync()
    {
        ValidateModel();

        var result = await PermissionAppService.GetAsync(ProviderName, ProviderKey);

        EntityDisplayName = !string.IsNullOrWhiteSpace(ProviderKeyDisplayName)
            ? ProviderKeyDisplayName
            : result.EntityDisplayName;

        Groups = ObjectMapper
                 .Map <List <PermissionGroupDto>, List <PermissionGroupViewModel> >(result.Groups)
                 .OrderBy(g => g.DisplayName)
                 .ToList();

        foreach (var group in Groups)
        {
            new FlatTreeDepthFinder <PermissionGrantInfoViewModel>().SetDepths(group.Permissions);
        }

        foreach (var group in Groups)
        {
            group.IsAllPermissionsGranted = group.Permissions.All(p => p.IsGranted);
        }

        SelectAllInAllTabs = Groups.All(g => g.IsAllPermissionsGranted);

        return(Page());
    }
Example #3
0
        public async Task OpenAsync(string providerName, string providerKey)
        {
            _providerName = providerName;
            _providerKey  = providerKey;

            var result = await PermissionAppService.GetAsync(_providerName, _providerKey);

            _entityDisplayName = result.EntityDisplayName;
            _groups            = result.Groups;

            _disabledPermissions =
                _groups.SelectMany(x => x.Permissions)
                .Where(
                    x => x.IsGranted &&
                    x.GrantedProviders.All(y => y.ProviderName != _providerName)
                    ).ToList();

            _selectedTabName = GetNormalizedGroupName(_groups.First().Name);

            _modal.Show();
        }