@Test void existsWhenCurrentUserIsSuperAdmin() { XWikiContext xcontext = mock(XWikiContext.class); DocumentReference documentReference = new DocumentReference("wiki", "XWiki", "superadmin"); when(xcontext.getUserReference()).thenReturn(documentReference); when(this.contextProvider.get()).thenReturn(xcontext); when(this.userReferenceResolver.resolve(documentReference)).thenReturn(SuperAdminUserReference.INSTANCE); assertFalse(this.manager.exists(CurrentUserReference.INSTANCE)); }
@Override public boolean exists(UserReference userReference) { boolean exists; DocumentReference currentUserReference = getXWikiContext().getUserReference(); if (currentUserReference == null) { exists = false; } else { UserReference resolvedUserReference = this.userReferenceResolver.resolve(currentUserReference); if (SuperAdminUserReference.INSTANCE == resolvedUserReference || GuestUserReference.INSTANCE == resolvedUserReference) { exists = false; } else { exists = this.documentUserManager.exists(resolvedUserReference); } } return exists; }
CurrentUserManager implements UserManager { @Override public boolean exists(UserReference userReference) { boolean exists; DocumentReference currentUserReference = getXWikiContext().getUserReference(); if (currentUserReference == null) { exists = false; } else { UserReference resolvedUserReference = this.userReferenceResolver.resolve(currentUserReference); if (SuperAdminUserReference.INSTANCE == resolvedUserReference || GuestUserReference.INSTANCE == resolvedUserReference) { exists = false; } else { exists = this.documentUserManager.exists(resolvedUserReference); } } return exists; } }
CurrentUserManager implements UserManager { @Override public boolean exists(UserReference userReference) { boolean exists; DocumentReference currentUserReference = getXWikiContext().getUserReference(); if (currentUserReference == null) { exists = false; } else { UserReference resolvedUserReference = this.userReferenceResolver.resolve(currentUserReference); if (SuperAdminUserReference.INSTANCE == resolvedUserReference || GuestUserReference.INSTANCE == resolvedUserReference) { exists = false; } else { exists = this.documentUserManager.exists(resolvedUserReference); } } return exists; }  }
CurrentUserManager implements UserManager { @Override public boolean exists(UserReference userReference) { boolean exists; DocumentReference currentUserReference = getXWikiContext().getUserReference(); if (currentUserReference == null) { exists = false; } else { UserReference resolvedUserReference = this.userReferenceResolver.resolve(currentUserReference); if (SuperAdminUserReference.INSTANCE == resolvedUserReference || GuestUserReference.INSTANCE == resolvedUserReference) { exists = false; } else { exists = this.documentUserManager.exists(resolvedUserReference); } } return exists; }  @Override boolean exists(UserReference userReference); }
CurrentUserManager implements UserManager { @Override public boolean exists(UserReference userReference) { boolean exists; DocumentReference currentUserReference = getXWikiContext().getUserReference(); if (currentUserReference == null) { exists = false; } else { UserReference resolvedUserReference = this.userReferenceResolver.resolve(currentUserReference); if (SuperAdminUserReference.INSTANCE == resolvedUserReference || GuestUserReference.INSTANCE == resolvedUserReference) { exists = false; } else { exists = this.documentUserManager.exists(resolvedUserReference); } } return exists; }  @Override boolean exists(UserReference userReference);  }