mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-13 04:53:06 +00:00
[CST-5307] Add useCachedVersionIfAvailable and reRequestOnStale param to isAuthorized method
This commit is contained in:
@@ -65,9 +65,13 @@ export class AuthorizationDataService extends DataService<Authorization> {
|
||||
* @param ePersonUuid UUID of the {@link EPerson} to search {@link Authorization}s for.
|
||||
* If not provided, the UUID of the currently authenticated {@link EPerson} will be used.
|
||||
* @param featureId ID of the {@link Feature} to check {@link Authorization} for
|
||||
* @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's
|
||||
* no valid cached version. Defaults to true
|
||||
* @param reRequestOnStale Whether or not the request should automatically be re-
|
||||
* requested after the response becomes stale
|
||||
*/
|
||||
isAuthorized(featureId?: FeatureID, objectUrl?: string, ePersonUuid?: string): Observable<boolean> {
|
||||
return this.searchByObject(featureId, objectUrl, ePersonUuid, {}, true, true, followLink('feature')).pipe(
|
||||
isAuthorized(featureId?: FeatureID, objectUrl?: string, ePersonUuid?: string, useCachedVersionIfAvailable = true, reRequestOnStale = true): Observable<boolean> {
|
||||
return this.searchByObject(featureId, objectUrl, ePersonUuid, {}, useCachedVersionIfAvailable, useCachedVersionIfAvailable, followLink('feature')).pipe(
|
||||
getFirstCompletedRemoteData(),
|
||||
map((authorizationRD) => {
|
||||
if (authorizationRD.statusCode !== 401 && hasValue(authorizationRD.payload) && isNotEmpty(authorizationRD.payload.page)) {
|
||||
|
Reference in New Issue
Block a user