Exemplo n.º 1
0
        public async Task <bool> HasAllPermissionsAsync(IRequest req, IAuthSession session, IAuthRepositoryAsync authRepo)
        {
            if (await SessionValidForAllPermissionsAsync(req, session, RequiredPermissions).ConfigAwait())
            {
                return(true);
            }

            return(await session.HasAllPermissionsAsync(RequiredPermissions, authRepo, req).ConfigAwait());
        }
Exemplo n.º 2
0
        public static async Task <bool> HasAllPermissionsAsync(IRequest req, IAuthSession session, ICollection <string> requiredPermissions, CancellationToken token = default)
        {
            if (await SessionValidForAllPermissionsAsync(req, session, requiredPermissions).ConfigAwait())
            {
                return(true);
            }

            var authRepo = HostContext.AppHost.GetAuthRepositoryAsync(req);

            await using (authRepo as IAsyncDisposable)
            {
                return(await session.HasAllPermissionsAsync(requiredPermissions, authRepo, req, token).ConfigAwait());
            }
        }