📄 jahiauser.java
字号:
//// ____.// __/\ ______| |__/\. _______// __ .____| | \ | +----+ \// _______| /--| | | - \ _ | : - \_________// \\______: :---| : : | : | \________>// |__\---\_____________:______: :____|____:_____\// /_____|//// . . . i n j a h i a w e t r u s t . . .////// FH - 18 Jan. 2001 :// 1. Made this class compatible with the Principal Java interface// 2. Added password encryption//package org.jahia.services.usermanager;import java.security.Principal;import java.util.Properties;import java.util.Enumeration;import org.jahia.exceptions.JahiaSecurityException;import org.jahia.utils.JahiaConsole;/** * A JahiaUser represents a physical person who is defined by a username and * a password for authentification purpose. Every other property of a JahiaUser * is stored in it's properties list, which hold key-value string pairs. For * example email, firstname, lastname, ... information should be stored in this * properties list. * * @author Fulco Houkes * @version 2.1 */public interface JahiaUser extends Principal{ //------------------------------------------------------------------------- // FH 29 Mar. 2001 /** * Return the unique user's username ( = his user key ) * * @return Return a String representation of the user. In Jahia this * corresponds to the user key, which is unique within a Jahia system. */ public String getName (); //------------------------------------------------------------------------- // FH 29 Mar. 2001 /** * Return the user username. * * @return * Return the username. */ public String getUsername (); //------------------------------------------------------------------------- // NK 12 Avr. 2001 /** * Return the unique String identifier of this user. * * @return the unique String identifier of this user. */ public String getUserKey(); //------------------------------------------------------------------------- // NK 12 Avr. 2001 /** * Return the id of the owner ( the site ) of this user. * * @return the id owner of this user. */ public int getSiteID(); /** * Sets the id of the owner ( the site ) of this user. * * @param siteID the id owner of this user. */ public void setSiteID(int siteID); //------------------------------------------------------------------------- /** * Returns the group's home page id. * -1 : undefined * * @return int The group homepage id. */ public abstract int getHomepageID (); //------------------------------------------------------------------------- /** * Set the home page id. * * @param int The group homepage id. * @return false on error */ public abstract boolean setHomepageID (int id); //------------------------------------------------------------------------- // FH 29 Mar. 2001 /** * Return a unique hashcode identifiying the user. The returned integer * must be unique for each specific user. For exemple, two different users * must return 2 different integer values, but two instanciation of the * same user must return the same value. * * @return * Return a valid hashcode integer of the user, on failure, -1 is * returned. */ public int hashCode (); //-------------------------------------------------------------------------- // FH 29 Mar. 2001 /** * Get user's properties list. * * @return Return a reference on the user's properties list, or null if no * property is present. */ public Properties getProperties (); //-------------------------------------------------------------------------- // FH 29 Mar. 2001 /** * Retrieve the requested user property. * * @param key Property's name. * * @return Return the property's value of the specified key, or null if the * property does not exist. */ public String getProperty (String key); //-------------------------------------------------------------------------- // FH 29 Mar. 2001 /** * Remove the specified property from the properties list. * * @param key Property's name. */ public boolean removeProperty (String key); //-------------------------------------------------------------------------- // FH 29 Mar. 2001 /** * Add (or update if not already in the property list) a property key-value * pair in the user's properties list. * * @param key Property's name. * @param value Property's value. */ public boolean setProperty (String key, String value); //-------------------------------------------------------------------------- // FH 29 Mar. 2001 /** * Return a string representation of the user and it's internal state. * * @return A string representation of this user. */ public abstract String toString (); //-------------------------------------------------------------------------- // FH 29 Mar. 2001 /** * Compare this User to specified object. Return true if this user is the * same as the object passed in. * * @param another * Principal compare with. * * @return * Return true if the passed in is the same as the encapsulated by this * Principal, and false otherwise. */ public boolean equals (Object another); //--------------------------------------------------------------------------- // FH 29 Mar. 2001 /** * Change the user's password. * * @param oldPassword * Old user's password * @param newPassword * New user's password * * @return * Return true id the old password is the same as the current one and * the new password is valid. Return false on any failure. * * @exception * JahiaSecurityException This exception is raised if the old user's * password passed in is not the same as the current encapsulated one. */ public boolean setPassword (String password); //-------------------------------------------------------------------------- // FH 29 Mar. 2001 /** * Test if the user is member of the specified group. * * @param name * Groupname. * * @return * Return true if the user is member of the specified group, or * false on any error. */ public boolean isMemberOfGroup (int siteID, String name); //-------------------------------------------------------------------------- // NK 06 Avr. 2001 /** * Test if the user is an admin member * * * @return * Return true if the user is an admin member * false on any error. */ public boolean isAdminMember (int siteID); /** * Test if the user is the root user * * @return * Return true if the user is the root user * false on any error. */ public boolean isRoot (); //-------------------------------------------------------------------------- // FH 29 Mar. 2001 /** * Verifiy if the passed in password is the same as the encapsulated by this * user. * * @param password * String representation of an non-encrypted password. * * @return * Return true if the passed in password is the same as the * encapsulated password in this user, and return false on any error. */ public boolean verifyPassword (String password); /** * Get the name of the provider of this user. * * @return * String representation of the name of the provider of this user */ public String getProviderName();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -