@@ -1082,6 +1082,7 @@ public void isAuthorizedForAttributeAssociatedReadRole() throws Exception {
10821082 PerunPrincipal mockedPerunPrincipal = mock (PerunPrincipal .class , RETURNS_DEEP_STUBS );
10831083 when (mockedPerunPrincipal .isAuthzInitialized ()).thenReturn (true );
10841084 when (mockedPerunPrincipal .getRoles ()).thenReturn (new AuthzRoles (Role .GROUPOBSERVER , group ));
1085+ when (mockedPerunPrincipal .getRolesUpdatedAt ()).thenReturn (System .currentTimeMillis ());
10851086 when (mockedPerunPrincipal .getUser ()).thenReturn (sessionUser );
10861087 when (mockedPerunPrincipal .getUserId ()).thenReturn (sessionUser .getId ());
10871088
@@ -1115,6 +1116,7 @@ public void isNotAuthorizedForAttributeAssociatedReadRoleWriteAction() throws Ex
11151116 PerunSessionImpl testSession = new PerunSessionImpl (sess .getPerun (), mockedPerunPrincipal , sess .getPerunClient ());
11161117
11171118 when (mockedPerunPrincipal .getRoles ()).thenReturn (new AuthzRoles (Role .GROUPADMIN , group ));
1119+ when (mockedPerunPrincipal .getRolesUpdatedAt ()).thenReturn (System .currentTimeMillis ());
11181120 assertTrue (AuthzResolver .isAuthorizedForAttribute (testSession , AttributeAction .WRITE , attrDef , group , false ));
11191121
11201122 when (mockedPerunPrincipal .getRoles ()).thenReturn (new AuthzRoles (Role .GROUPOBSERVER , group ));
@@ -1141,6 +1143,7 @@ public void isAuthorizedByDefault() throws Exception {
11411143 PerunPrincipal mockedPerunPrincipal = mock (PerunPrincipal .class , RETURNS_DEEP_STUBS );
11421144 when (mockedPerunPrincipal .isAuthzInitialized ()).thenReturn (true );
11431145 when (mockedPerunPrincipal .getRoles ()).thenReturn (new AuthzRoles (Role .PERUNOBSERVER ));
1146+ when (mockedPerunPrincipal .getRolesUpdatedAt ()).thenReturn (System .currentTimeMillis ());
11441147 when (mockedPerunPrincipal .getUser ()).thenReturn (sessionUser );
11451148 when (mockedPerunPrincipal .getUserId ()).thenReturn (sessionUser .getId ());
11461149
@@ -1196,6 +1199,7 @@ public void setRoleGroupAdminSucceedsForVoAdmin() throws Exception {
11961199 PerunPrincipal mockedPerunPrincipal = mock (PerunPrincipal .class , RETURNS_DEEP_STUBS );
11971200 when (mockedPerunPrincipal .isAuthzInitialized ()).thenReturn (true );
11981201 when (mockedPerunPrincipal .getRoles ()).thenReturn (new AuthzRoles (Role .VOADMIN , testVo ));
1202+ when (mockedPerunPrincipal .getRolesUpdatedAt ()).thenReturn (System .currentTimeMillis ());
11991203
12001204 PerunSession testSession = new PerunSessionImpl (sess .getPerun (), mockedPerunPrincipal , sess .getPerunClient ());
12011205
@@ -1215,6 +1219,7 @@ public void setRoleGroupAdminFailsWithoutSufficientRole() throws Exception {
12151219 PerunPrincipal mockedPerunPrincipal = mock (PerunPrincipal .class , RETURNS_DEEP_STUBS );
12161220 when (mockedPerunPrincipal .isAuthzInitialized ()).thenReturn (true );
12171221 when (mockedPerunPrincipal .getRoles ()).thenReturn (new AuthzRoles (Role .VOADMIN , otherVo ));
1222+ when (mockedPerunPrincipal .getRolesUpdatedAt ()).thenReturn (System .currentTimeMillis ());
12181223
12191224 PerunSession testSession = new PerunSessionImpl (sess .getPerun (), mockedPerunPrincipal , sess .getPerunClient ());
12201225
@@ -1243,6 +1248,7 @@ public void getVoAdminGroupsWithProperRights() throws Exception {
12431248 PerunPrincipal mockedPerunPrincipal = mock (PerunPrincipal .class , RETURNS_DEEP_STUBS );
12441249 when (mockedPerunPrincipal .isAuthzInitialized ()).thenReturn (true );
12451250 when (mockedPerunPrincipal .getRoles ()).thenReturn (new AuthzRoles (Role .VOADMIN , testVo ));
1251+ when (mockedPerunPrincipal .getRolesUpdatedAt ()).thenReturn (System .currentTimeMillis ());
12461252 PerunSession testSession = new PerunSessionImpl (sess .getPerun (), mockedPerunPrincipal , sess .getPerunClient ());
12471253
12481254 AuthzResolver .setRole (testSession , testGroup , testVo , Role .VOADMIN );
@@ -1262,6 +1268,7 @@ public void getVoAdminGroupsWithInsufficientRights() throws Exception {
12621268 PerunPrincipal mockedPerunPrincipal = mock (PerunPrincipal .class , RETURNS_DEEP_STUBS );
12631269 when (mockedPerunPrincipal .isAuthzInitialized ()).thenReturn (true );
12641270 when (mockedPerunPrincipal .getRoles ()).thenReturn (new AuthzRoles ());
1271+ when (mockedPerunPrincipal .getRolesUpdatedAt ()).thenReturn (System .currentTimeMillis ());
12651272 PerunSession testSession = new PerunSessionImpl (sess .getPerun (), mockedPerunPrincipal , sess .getPerunClient ());
12661273
12671274 AuthzResolver .setRole (sess , testGroup , testVo , Role .VOADMIN );
@@ -1279,6 +1286,7 @@ public void getVoDirectRichAdminsWithProperRights() throws Exception {
12791286 PerunPrincipal mockedPerunPrincipal = mock (PerunPrincipal .class , RETURNS_DEEP_STUBS );
12801287 when (mockedPerunPrincipal .isAuthzInitialized ()).thenReturn (true );
12811288 when (mockedPerunPrincipal .getRoles ()).thenReturn (new AuthzRoles (Role .VOADMIN , testVo ));
1289+ when (mockedPerunPrincipal .getRolesUpdatedAt ()).thenReturn (System .currentTimeMillis ());
12821290 PerunSession testSession = new PerunSessionImpl (sess .getPerun (), mockedPerunPrincipal , sess .getPerunClient ());
12831291
12841292 AuthzResolver .setRole (testSession , testUser , testVo , Role .VOADMIN );
@@ -1299,6 +1307,7 @@ public void getVoDirectRichAdminsWithInsufficientRights() throws Exception {
12991307 PerunPrincipal mockedPerunPrincipal = mock (PerunPrincipal .class , RETURNS_DEEP_STUBS );
13001308 when (mockedPerunPrincipal .isAuthzInitialized ()).thenReturn (true );
13011309 when (mockedPerunPrincipal .getRoles ()).thenReturn (new AuthzRoles ());
1310+ when (mockedPerunPrincipal .getRolesUpdatedAt ()).thenReturn (System .currentTimeMillis ());
13021311 PerunSession testSession = new PerunSessionImpl (sess .getPerun (), mockedPerunPrincipal , sess .getPerunClient ());
13031312
13041313 AuthzResolver .setRole (sess , testUser , testVo , Role .VOADMIN );
@@ -1321,6 +1330,7 @@ public void getVoRichAdminsWithProperRights() throws Exception {
13211330 PerunPrincipal mockedPerunPrincipal = mock (PerunPrincipal .class , RETURNS_DEEP_STUBS );
13221331 when (mockedPerunPrincipal .isAuthzInitialized ()).thenReturn (true );
13231332 when (mockedPerunPrincipal .getRoles ()).thenReturn (new AuthzRoles (Role .VOADMIN , testVo ));
1333+ when (mockedPerunPrincipal .getRolesUpdatedAt ()).thenReturn (System .currentTimeMillis ());
13241334 PerunSession testSession = new PerunSessionImpl (sess .getPerun (), mockedPerunPrincipal , sess .getPerunClient ());
13251335
13261336 AuthzResolver .setRole (testSession , testUser , testVo , Role .VOADMIN );
0 commit comments