Beispiel #1
0
        public async Task <PagedResult <AuthorizationPolicyInfo> > GetPageOfPolicies(
            string query   = null,
            int pageNumber = 1,
            int pageSize   = 10,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.ThrowIfCancellationRequested();
            var result = await _queries.GetPage(_tenantProvider.GetTenantId(), query, pageNumber, pageSize, cancellationToken).ConfigureAwait(false);

            return(result);
        }
        private async Task <bool> PolicyExistWithRole(Guid siteId, string role)
        {
            var all = await _queries.GetPage(siteId.ToString(), null, 1, 900000).ConfigureAwait(false);

            for (var i = 0; i < all.Data.Count; i++)
            {
                var policy = all.Data[i];
                if (policy.AllowedRoles.Contains(role))
                {
                    return(true);
                }
            }

            return(false);
        }