Skip to content

Commit 0a4ab6c

Browse files
Teodossi Dossevteodossidossev
authored andcommitted
fix(GDB-12688) Treat empty repository ID as “no selection” in JWT auth check
## What: Update the repository selection guard in jwt-auth.service.js to treat an empty id string as `no repository selected` ## Why: The method getActiveRepositoryObjectFromStorage() always returns an object (with default {"id":"","location":""}), so the old check if (!getActiveRepositoryObjectFromStorage()) never passed. As a result, GraphQL users without a real repository selected were blocked and saw blank pages. ## How: Replace the falsy object check with an explicit empty ID check
1 parent c99749c commit 0a4ab6c

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

packages/legacy-workbench/src/js/angular/core/services/jwt-auth.service.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ angular.module('graphdb.framework.core.services.jwtauth', [
410410
}
411411

412412
// If there is no selected repository, there are no auth restrictions
413-
if (!getActiveRepositoryObjectFromStorage()) {
413+
if (getActiveRepositoryObjectFromStorage().id === '') {
414414
return true;
415415
}
416416

@@ -425,7 +425,6 @@ angular.module('graphdb.framework.core.services.jwtauth', [
425425
// Check if any of the allowed authorities match one of the principal's authorities
426426
return auth.some(allowAuth => this.principal.authorities.indexOf(allowAuth) > -1);
427427
}
428-
429428
// If none of the above conditions apply, return true by default
430429
return true;
431430
}

0 commit comments

Comments
 (0)