Ejemplo n.º 1
0
        public static Task <bool> HasAnyRolesAsync(this IAuthSession session, ICollection <string> roles,
                                                   IAuthRepositoryAsync authRepo, IRequest req, CancellationToken token = default)
        {
            if (session is IAuthSessionExtended extended) // always true for sessions inheriting AuthUserSession
            {
                return(extended.HasAnyRolesAsync(roles, authRepo, req, token));
            }

#pragma warning disable 618
            return(session.HasAnyRoles(roles, (IAuthRepository)authRepo, req).InTask());

#pragma warning restore 618
        }
 public virtual bool HasAnyRoles(IRequest req, IAuthSession session, IAuthRepository authRepo)
 {
     return(session.HasAnyRoles(RequiredRoles, authRepo, req));
 }