@Test public void isDisabled() { XWikiUser user = new XWikiUser(userReference); when(userDocument.getIntValue(userClassReference, XWikiUser.ACTIVE_PROPERTY, 1)).thenReturn(1); assertFalse(user.isDisabled(mockitoOldcore.getXWikiContext())); when(userDocument.getIntValue(userClassReference, XWikiUser.ACTIVE_PROPERTY, 1)).thenReturn(0); assertTrue(user.isDisabled(mockitoOldcore.getXWikiContext())); user = new XWikiUser((DocumentReference) null); assertFalse(user.isDisabled(mockitoOldcore.getXWikiContext())); user = new XWikiUser(XWikiRightService.SUPERADMIN_USER_FULLNAME); assertFalse(user.isDisabled(mockitoOldcore.getXWikiContext())); }
@Unstable public boolean isDisabled(XWikiContext context) { boolean disabled; if (isGuest() || isSuperAdmin()) { disabled = false; } else { try { XWikiDocument userdoc = getUserDocument(context); DocumentReference userClassReference = getUserClassReference(userdoc.getDocumentReference().getWikiReference()); disabled = userdoc.getIntValue(userClassReference, ACTIVE_PROPERTY, 1) == 0; } catch (XWikiException e) { this.logger.error("Error while checking active status of user [{}]", getUser(), e); disabled = false; } } return disabled; }
XWikiUser { @Unstable public boolean isDisabled(XWikiContext context) { boolean disabled; if (isGuest() || isSuperAdmin()) { disabled = false; } else { try { XWikiDocument userdoc = getUserDocument(context); DocumentReference userClassReference = getUserClassReference(userdoc.getDocumentReference().getWikiReference()); disabled = userdoc.getIntValue(userClassReference, ACTIVE_PROPERTY, 1) == 0; } catch (XWikiException e) { this.logger.error("Error while checking active status of user [{}]", getUser(), e); disabled = false; } } return disabled; } }
XWikiUser { @Unstable public boolean isDisabled(XWikiContext context) { boolean disabled; if (isGuest() || isSuperAdmin()) { disabled = false; } else { try { XWikiDocument userdoc = getUserDocument(context); DocumentReference userClassReference = getUserClassReference(userdoc.getDocumentReference().getWikiReference()); disabled = userdoc.getIntValue(userClassReference, ACTIVE_PROPERTY, 1) == 0; } catch (XWikiException e) { this.logger.error("Error while checking active status of user [{}]", getUser(), e); disabled = false; } } return disabled; } @Unstable  XWikiUser(DocumentReference userReference); @Unstable  XWikiUser(DocumentReference userReference, boolean main); @Deprecated  XWikiUser(String user); @Deprecated  XWikiUser(String user, boolean main); }
XWikiUser { @Unstable public boolean isDisabled(XWikiContext context) { boolean disabled; if (isGuest() || isSuperAdmin()) { disabled = false; } else { try { XWikiDocument userdoc = getUserDocument(context); DocumentReference userClassReference = getUserClassReference(userdoc.getDocumentReference().getWikiReference()); disabled = userdoc.getIntValue(userClassReference, ACTIVE_PROPERTY, 1) == 0; } catch (XWikiException e) { this.logger.error("Error while checking active status of user [{}]", getUser(), e); disabled = false; } } return disabled; } @Unstable  XWikiUser(DocumentReference userReference); @Unstable  XWikiUser(DocumentReference userReference, boolean main); @Deprecated  XWikiUser(String user); @Deprecated  XWikiUser(String user, boolean main); @Deprecated String getUser(); String getFullName(); DocumentReference getUserReference(); @Unstable boolean isEmailChecked(XWikiContext context); @Unstable void setEmailChecked(boolean checked, XWikiContext context); @Unstable boolean isDisabled(XWikiContext context); @Unstable void setDisabled(boolean disable, XWikiContext context); @Unstable boolean exists(XWikiContext context); void setUser(String user); boolean isUserInGroup(String groupName, XWikiContext context); boolean isMain(); void setMain(boolean main); @Override String toString(); @Override boolean equals(Object obj); }
XWikiUser { @Unstable public boolean isDisabled(XWikiContext context) { boolean disabled; if (isGuest() || isSuperAdmin()) { disabled = false; } else { try { XWikiDocument userdoc = getUserDocument(context); DocumentReference userClassReference = getUserClassReference(userdoc.getDocumentReference().getWikiReference()); disabled = userdoc.getIntValue(userClassReference, ACTIVE_PROPERTY, 1) == 0; } catch (XWikiException e) { this.logger.error("Error while checking active status of user [{}]", getUser(), e); disabled = false; } } return disabled; } @Unstable  XWikiUser(DocumentReference userReference); @Unstable  XWikiUser(DocumentReference userReference, boolean main); @Deprecated  XWikiUser(String user); @Deprecated  XWikiUser(String user, boolean main); @Deprecated String getUser(); String getFullName(); DocumentReference getUserReference(); @Unstable boolean isEmailChecked(XWikiContext context); @Unstable void setEmailChecked(boolean checked, XWikiContext context); @Unstable boolean isDisabled(XWikiContext context); @Unstable void setDisabled(boolean disable, XWikiContext context); @Unstable boolean exists(XWikiContext context); void setUser(String user); boolean isUserInGroup(String groupName, XWikiContext context); boolean isMain(); void setMain(boolean main); @Override String toString(); @Override boolean equals(Object obj); @Unstable
    static final String ACTIVE_PROPERTY; @Unstable
    static final String EMAIL_CHECKED_PROPERTY; }