Hello,
I have created a JS policy and associated it to a Scope based permission, but when trying to get the permission scopes using $evaluation.getPermission().getScopes()
, I get unexpected behaviour. Although js detects that scopes is an array of ScopeAdapters, when trying to fetch the first scope it returns undefined.
Code:
var scopes = $evaluation.getPermission().getScopes();
print('SCOPES: ' + scopes);
print('SCOPES: ' + scopes[0]);
print('SCOPES: ' + scopes[0].getName());
Result
SCOPES: [org.keycloak.models.cache.infinispan.authorization.ScopeAdapter@70b5a43f]
SCOPES: undefined
(error stack trace)
TypeError: Cannot read property "getName" from undefined in <eval>
``