com.sap.security.api

Interface IUser

All Superinterfaces:
IPrincipal, Principal, Serializable
All Known Subinterfaces:
IUserMaint

public interface IUser
extends Principal, IPrincipal

This interface provides read-access to the user's attributes, and offers basic support for authorization checking. Implementations of this interface must make sure that all get-methods with a return type of String, e.g. getFax() etc. return null if that attribute either does not exist or has a null value in the user store. This does NOT apply to the generic getAttribute...() methods.

If you want to keep and persist an identifier as a reference to an instance of IUser you must use method IPrincipal.getUniqueID(). As this identifier contains internal information and is usually not readable, it should not be used in end user interfaces.

Use methods IPrincipal.getDisplayName() or getUniqueName() in order to display attributes with a nice name for user interfaces.

NOTE: As this interface�can be extended, this interface can be freely used, but must not be implemented.


Field Summary
static int DEFAULT_ACCESSIBILITY_LEVEL
          Constant used for user's default accessibility level
static int SCREENREADER_ACCESSIBILITY_LEVEL
          Constant used for user's screen reader support
static String VERSIONSTRING
           
 
Fields inherited from interface com.sap.security.api.IPrincipal
BYTE_TYPE, CREATED_BY, DATASOURCE, DEFAULT_NAMESPACE, DEFAULT_RELATION_NAMESPACE, DESCRIPTION, DISPLAYNAME, LAST_MODIFIED_BY, PRINCIPAL_CREATION_DATE, PRINCIPAL_MODIFY_DATE, PRINCIPAL_RELATION_MEMBER_ATTRIBUTE, PRINCIPAL_RELATION_PARENT_ATTRIBUTE, STRING_TYPE, TRANSIENT_NAMESPACE, UNIQUE_NAME
 
Method Summary
 void checkPermission(Permission permission)
          If the user has the specified permission, this method does nothing.
 void checkPermission(String contextID, Permission permission)
          If the user has the specified permission in the given context, this method does nothing.
 int getAccessibilityLevel()
          Gets the user's accessibilityLevel used for Screen Reader Support
 String getCellPhone()
          Gets the user's default cellphone number.
 String getCity()
          Gets the user's city.
 String getCompany()
          NOTE: Released for internal use only.
 String getCountry()
          Gets the ISO-3166 two-letter uppercase code of the country where the user lives.
 String getCurrency()
          Gets the three letter uppercase code of the user's currency, e.g.
 String getDepartment()
          Gets the user's department.
 String getEmail()
          Gets the user's default email address.
 String getFax()
          Gets the user's default fax number.
 String getFirstName()
          Gets the user's first name.
 com.sap.i18n.cpbase.I18nFormatterFactory getI18nFormatterFactory()
          Creates I18nFormatterFactory with the current user format settings and locale.
 String getJobTitle()
          Gets the user's job title, e.g.
 String getLastName()
          Gets the user's last name.
 Locale getLocale()
          Gets the user's Locale; this determines e.g. the language in which text is displayed to the user's and the style that numbers are formated.
 Iterator getParentGroups(boolean recursive)
          Gets the list of (all) parent groups including parents, grandparents, ...
 String getPersonID()
          Returns the personID of the IUser or null.
 Iterator getRoles(boolean recursive)
          Gets the list of (all) assigned roles of this user including parent groups, grandparent groups,...
 String getSalutation()
          Gets the user's salutation, e.g.
 String getState()
          Gets the user's state or region.
 String getStreet()
          Gets the user's street.
 String getTelephone()
          Gets the user's default telephone number.
 TimeZone getTimeZone()
          Gets the user's time zone.
 String getTitle()
          Gets the user's academic title or title of nobility
 Object getTransientAttribute(String namespace, String name)
          Generic get method to access additional transient attributes.
 String getUid()
          Deprecated. new applications should use IPrincipal.getUniqueID().
 String getUniqueName()
          Get uniqueName of this IUser object.
 IUserAccount[] getUserAccounts()
          Returns an array of useraccount objects which are assigned to this user.
 Iterator getUserAccountUniqueIDs()
          Returns an iterator of String objects which represent the uniqueIDs of assigned IUserAccount objects
 IUserFactory getUserFactory()
          Gets the user factory which instantiated this user object.
 String getZip()
          Gets the zip code of the user's city.
 boolean hasPermission(Permission permission)
          Returns true if the user has the given permission.
 boolean hasPermission(String contextID, Permission permission)
          Returns true if the user has the given permission in the given context.
 boolean isCompanyUser()
          Checks if this user belongs to a company.
 boolean isMemberOfGroup(String uniqueIdOfGroup, boolean recursive)
          Checks if the principal belongs to the passed uniqueIdOfGroup This method does a recursive search, so if this principal belongs to a group which is a member of this group, true is returned.
 boolean isMemberOfRole(String uniqueIdOfRole, boolean recursive)
          Checks if the principal belongs to the passed roleId This method does a recursive search if parameter recursive is set to true.
 boolean setTransientAttribute(String namespace, String name, Object o)
          Generic method to associate arbitrary data with a principal.
 
Methods inherited from interface java.security.Principal
equals, getName, hashCode, toString
 
Methods inherited from interface com.sap.security.api.IPrincipal
created, equals, getAttribute, getAttributeNames, getAttributeNamespaces, getAttributeType, getBinaryAttribute, getDisplayName, getMessages, getParents, getUniqueID, hashCode, isExistenceChecked, isMutable, lastModified, refresh
 

Field Detail

VERSIONSTRING

static final String VERSIONSTRING
See Also:
Constant Field Values

DEFAULT_ACCESSIBILITY_LEVEL

static final int DEFAULT_ACCESSIBILITY_LEVEL
Constant used for user's default accessibility level

See Also:
Constant Field Values

SCREENREADER_ACCESSIBILITY_LEVEL

static final int SCREENREADER_ACCESSIBILITY_LEVEL
Constant used for user's screen reader support

See Also:
Constant Field Values
Method Detail

getUid

String getUid()
Deprecated. new applications should use IPrincipal.getUniqueID().

Gets the user ID. This method is included for backward compatibility with the SAPMarkets user management only. New applications should not use it.


getJobTitle

String getJobTitle()
Gets the user's job title, e.g. Developer, Development Architect, Development Manager etc.

Returns:
String user's job title

getDepartment

String getDepartment()
Gets the user's department.

Returns:
String user's department

getTitle

String getTitle()
Gets the user's academic title or title of nobility

Returns:
String user's academic title

getSalutation

String getSalutation()
Gets the user's salutation, e.g. Mr., Ms., Mrs.

Returns:
String user's salutation

getFirstName

String getFirstName()
Gets the user's first name. This may include one or more middle names.

Returns:
String user's first name

getLastName

String getLastName()
Gets the user's last name. This may include second names.

Returns:
String user's last name

getStreet

String getStreet()
Gets the user's street. This may include house numbers, street numbers etc.

Returns:
String user's street address

getCity

String getCity()
Gets the user's city.

Returns:
String user's city

getZip

String getZip()
Gets the zip code of the user's city.

Returns:
String user's zip code

getState

String getState()
Gets the user's state or region.

Returns:
String user's state or region

getCountry

String getCountry()
Gets the ISO-3166 two-letter uppercase code of the country where the user lives. NOTE that this is independent from the country available via getCountry() of the user's Locale, since expatriate users may not have their Locale's country set to the country where they actually reside.

Returns:
String user's country

getLocale

Locale getLocale()
Gets the user's Locale; this determines e.g. the language in which text is displayed to the user's and the style that numbers are formated. Applications needing to get the country where the user resides must call getCountry() instead of using the Locale's country.

Returns:
Locale user's locale object or null in case no locale is stored for this IUser object.

getTimeZone

TimeZone getTimeZone()
Gets the user's time zone.

Returns:
TimeZone user's timezone object or null in case no timezone is stored for this IUser object.

NOTE: Do not modify this TimeZone object. For performance reasons the TimeZone object is only created once when method getTimeZone() is called the first time. In case you modify this TimeZone object you may encounter inconsistencies because the user object has a different Timezone value set on the persistence layer.


getCurrency

String getCurrency()
Gets the three letter uppercase code of the user's currency, e.g. DEM, EUR or USD.

Returns:
String user's currency

getTelephone

String getTelephone()
Gets the user's default telephone number.

Returns:
String user's telephone

getCellPhone

String getCellPhone()
Gets the user's default cellphone number.

Returns:
String user's cell phone

getFax

String getFax()
Gets the user's default fax number.

Returns:
String user's fax

getEmail

String getEmail()
Gets the user's default email address.

Returns:
String user's email

isCompanyUser

boolean isCompanyUser()
Checks if this user belongs to a company.

Returns:
true if user belongs to company

getCompany

String getCompany()
NOTE: Released for internal use only. Gets the company ID of the user's company.

Returns:
String company id

getUserFactory

IUserFactory getUserFactory()
Gets the user factory which instantiated this user object.

Returns:
IUserFactory user factory

hasPermission

boolean hasPermission(Permission permission)
Returns true if the user has the given permission.

Parameters:
permission - Permission object which is checked
Returns:
true if the user has the given permission.

checkPermission

void checkPermission(Permission permission)
                     throws AccessControlException
If the user has the specified permission, this method does nothing. If not, it will throw an AccessControlException, and possibly trigger appropriate logging action.

Parameters:
permission - Permission object which is checked
Throws:
AccessControlException - if the user doesn't have the specified permission

hasPermission

boolean hasPermission(String contextID,
                      Permission permission)
Returns true if the user has the given permission in the given context. Note: The context specific permission check is no longer supported. It does the same as hasPermission(java.security.Permission).

Parameters:
contextID - context for that the permission is checked
permission - Permission object which is checked
Returns:
true if the user has the given permission.

checkPermission

void checkPermission(String contextID,
                     Permission permission)
                     throws AccessControlException
If the user has the specified permission in the given context, this method does nothing. If not, it will throw an AccessControlException, and possibly trigger appropriate logging action. Note: The context specific permission check is no longer supported. It does the same as checkPermission(java.security.Permission).

Parameters:
contextID - context for that the permission is checked
permission - Permission object which is checked
Throws:
AccessControlException - if the user doesn't have the specified permission

getUserAccounts

IUserAccount[] getUserAccounts()
                               throws UMException
Returns an array of useraccount objects which are assigned to this user. Returns a empty array of type IUserAccount in case that this user is not assigned to any accounts.

Returns:
IUserAccount[] user account objects associated with this user
Throws:
UMException

getUserAccountUniqueIDs

Iterator getUserAccountUniqueIDs()
                                 throws UMException
Returns an iterator of String objects which represent the uniqueIDs of assigned IUserAccount objects

Returns:
iterator of accounts assigned to this principal. The iterator contains String objects representing the uniqueIDs of assigned IUserAccount objects.
Throws:
UMException

getAccessibilityLevel

int getAccessibilityLevel()
Gets the user's accessibilityLevel used for Screen Reader Support

Returns:
accessibility level of screen reader support. If no value is set in datastore the default return value is DEFAULT_ACCESSIBILITY_LEVEL Following constants can be returned: DEFAULT_ACCESSIBILITY_LEVEL SCREENREADER_ACCESSIBILITY_LEVEL

getRoles

Iterator getRoles(boolean recursive)
Gets the list of (all) assigned roles of this user including parent groups, grandparent groups,... if recursive is set to true NOTE: This method may also return roles which are already deleted.

Parameters:
recursive - if true returns all parent roles
Returns:
iterator of roles for this principal. The iterator contains uniqueIdOfRole strings

getParentGroups

Iterator getParentGroups(boolean recursive)
Gets the list of (all) parent groups including parents, grandparents, ... if recursive is set to true

Parameters:
recursive - if true returns all parent groups
Returns:
iterator of groups of this user. The iterator contains uniqueIdOfGroup strings

isMemberOfRole

boolean isMemberOfRole(String uniqueIdOfRole,
                       boolean recursive)
Checks if the principal belongs to the passed roleId This method does a recursive search if parameter recursive is set to true. If this user belongs to a group which is a member of a role, true is returned.

Parameters:
uniqueIdOfRole - identifying the role
recursive - if true checks also all parent groups
Returns:
true if this user is directly or indirectly (via role membership) assigned.

isMemberOfGroup

boolean isMemberOfGroup(String uniqueIdOfGroup,
                        boolean recursive)
Checks if the principal belongs to the passed uniqueIdOfGroup This method does a recursive search, so if this principal belongs to a group which is a member of this group, true is returned.

Parameters:
uniqueIdOfGroup - the ID of the collection
Returns:
true if the principal is directly or indirectly (via group membership) assigned to uniqueIdOfGroup.

getUniqueName

String getUniqueName()
Get uniqueName of this IUser object. A (usually) unique readable name of an instance of IUser.

Note: Depending on the persistence layer it is not guaranteed that this name is unique. The uniqueName may change over time. Thus, do not persist the uniqueName. Always use the unique identifier of IPrincipal.getUniqueID() for this purpose.

Use the uniqueName for searching and displaying in user interfaces.

Returns:
uniqueName of object

getTransientAttribute

Object getTransientAttribute(String namespace,
                             String name)
Generic get method to access additional transient attributes. These attributes are contained in separate namespaces, and are accessible via their names. Attributes that are in no distinct namespace are formally located in the namespace null.

Note: the transient attributes are instance specific.

Parameters:
namespace - namespace the attribute is in (may be null)
name - name of the attribute
Returns:
the values of the respective attribute, or null if this namespace or attribute within this namespace does not exist

setTransientAttribute

boolean setTransientAttribute(String namespace,
                              String name,
                              Object o)
Generic method to associate arbitrary data with a principal. The method will return true if values is different from the attribute's previous values, false otherwise. These texts are tansient and will not be stored in the persistence.

Parameters:
namespace - namespace of the attribute to set.
name - name of the attribute
o - value of the attribute

getPersonID

String getPersonID()
                   throws UMException
Returns the personID of the IUser or null.

Returns:
the personID or null.
Throws:
UMException - if an error occurred.

getI18nFormatterFactory

com.sap.i18n.cpbase.I18nFormatterFactory getI18nFormatterFactory()
                                                                 throws UMException
Creates I18nFormatterFactory with the current user format settings and locale.

Returns:
The utility object to handle user format information.
Throws:
UMException - if an error occurred.
Access Rights

This class can be accessed from:


SC DC
[sap.com] ENGINEAPI [sap.com] com.sap.security.api.sda
[sap.com] ENGFACADE [sap.com] tc/je/usermanagement/api
[sap.com] CORE-TOOLS [sap.com] com.sap.engine.client.lib


Copyright 2010 SAP AG Complete Copyright Notice