public bool HasAllPermissions(IRequest req, IAuthSession session, IAuthRepository authRepo) { if (SessionValidForAllPermissions(req, session, RequiredPermissions)) { return(true); } return(session.HasAllPermissions(RequiredPermissions, authRepo, req)); }
public static Task <bool> HasAllPermissionsAsync(this IAuthSession session, ICollection <string> requiredPermissions, IAuthRepositoryAsync authRepo, IRequest req, CancellationToken token = default) { if (session is IAuthSessionExtended extended) // always true for sessions inheriting AuthUserSession { return(extended.HasAllPermissionsAsync(requiredPermissions, authRepo, req, token)); } #pragma warning disable 618 return(session.HasAllPermissions(requiredPermissions, (IAuthRepository)authRepo, req).InTask()); #pragma warning restore 618 }
public static bool HasAllPermissions(IRequest req, IAuthSession session, ICollection <string> requiredPermissions) { if (SessionValidForAllPermissions(req, session, requiredPermissions)) { return(true); } var authRepo = HostContext.AppHost.GetAuthRepository(req); using (authRepo as IDisposable) { return(session.HasAllPermissions(requiredPermissions, authRepo, req)); } }