Package de.hybris.platform.jalo.security
Class Principal
- java.lang.Object
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable
- Direct Known Subclasses:
GeneratedPrincipalGroup
,GeneratedUser
public abstract class Principal extends GeneratedPrincipal
This is the abstract base class of all hybris Platform users. Our security models allows to assign each principal a set ofUserRights
on oneItem
, which can be checked by theAccessManager
.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.hybris.platform.jalo.GenericItem
GenericItem.GenericItemImpl
-
Nested classes/interfaces inherited from class de.hybris.platform.jalo.c2l.LocalizableItem
LocalizableItem.LocalizableItemImpl
-
Nested classes/interfaces inherited from class de.hybris.platform.jalo.ExtensibleItem
ExtensibleItem.ExtensibleItemImpl
-
Nested classes/interfaces inherited from class de.hybris.platform.jalo.Item
Item.AttributeFilter, Item.AttributeMode, Item.CachedGetter, Item.CachedSetter, Item.ItemAttributeMap, Item.ItemConstraint, Item.ItemImpl, Item.JaloCachedComputationException
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ALLGROUPS
Deprecated.since ages - Old Jalo attribute that is now dynamic.static java.lang.String
ALLSEARCHRESTRICTIONS
Deprecated.since ages - it is a dynamic attribute nowstatic java.lang.String
DISPLAYNAME
Deprecated.since ages - it is a dynamic attribute nowstatic java.lang.String
PRINCIPAL_GROUP_RELATION_NAME
Deprecated.since ages - use instead CoreConstants.Relations.PRINCIPALGROUPRELATION-
Fields inherited from class de.hybris.platform.jalo.security.GeneratedPrincipal
DEFAULT_INITIAL_ATTRIBUTES, DESCRIPTION, GROUPS, NAME, PRINCIPALGROUPRELATION_MARKMODIFIED, PRINCIPALGROUPRELATION_SRC_ORDERED, PRINCIPALGROUPRELATION_TGT_ORDERED, SEARCHRESTRICTIONS, SEARCHRESTRICTIONSHANDLER, UID
-
Fields inherited from class de.hybris.platform.jalo.c2l.LocalizableItem
LANGUAGE_FALLBACK_ENABLED
-
Fields inherited from class de.hybris.platform.jalo.Item
_CREATION_TIME_INTERNAL, _MODIFIED_TIME_INTERNAL, accessorLog, CREATION_TIME, DISABLE_ATTRIBUTE_CHECK, DISABLE_ITEMCHECK_BEFORE_REMOVABLE, EVEN, FEATURE_ACCESSMAP_QUALIFIER, HJMPTS, INITIAL_CREATION_FLAG, isJaloOnly, MODIFIED_TIME, NEGATIVE, NOT_FOUND, OWNER, PK, POSITIVE, SAVE_FROM_SERVICE_LAYER, staticTransientObjects, TYPE
-
Fields inherited from class de.hybris.platform.util.BridgeAbstraction
impl, tenant
-
-
Constructor Summary
Constructors Constructor Description Principal()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addGlobalNegativePermission(UserRight permission)
Deprecated.void
addGlobalPermission(UserRight permission, boolean deny)
Deprecated.boolean
addGlobalPermissions(java.util.Collection<PermissionContainer> permissions)
Deprecated.since ages - usePermissionManagementService.addGlobalPermissions(Collection)
void
addGlobalPositivePermission(UserRight permission)
Deprecated.boolean
addToGroup(PrincipalGroup group)
Deprecated.since ages - useGeneratedPrincipal.addToGroups(SessionContext, PrincipalGroup)
insteadprotected void
checkConsistencyUid(java.lang.String uid, java.lang.String message, java.lang.String composedTypeCode)
boolean
checkGlobalPermission(UserRight right)
Deprecated.int
checkOwnGlobalPermission(PK userRightPK)
Deprecated.since ages - use(PrincipalModel, String)
abstract void
checkSystemPrincipal()
void
clearGlobalPermission(UserRight permission)
Deprecated.boolean
clearGlobalPermissions(java.util.Collection<PermissionContainer> permissions)
Deprecated.since ages - usePermissionManagementService.removeGlobalPermissions(Collection)
java.util.Map<Language,java.lang.String>
getAllDisplayName()
Deprecated.since agesabstract java.util.Map<Language,java.lang.String>
getAllDisplayName(SessionContext ctx)
Deprecated.since agesjava.util.Collection
getAllGlobalNegativePermissions()
Gets all negative permissions of this principal including all negative permissions of groups the principal is member of.java.util.Collection
getAllGlobalPositivePermissions()
Gets all positive permissions of this principal including all positive permissions of groups the principal is member of.java.util.Set<PrincipalGroup>
getAllGroups()
java.util.Set<PrincipalGroup>
getAllGroups(SessionContext ctx)
Gets all groups this principal is member of ( transitive ! ).java.util.Collection<SearchRestriction>
getAllSearchRestrictions()
Gets all search restrictions of this principal.java.util.Collection<SearchRestriction>
getAllSearchRestrictions(SessionContext ctx)
Gets all search restrictions of this principal.java.lang.String
getDisplayName()
Deprecated.since ages - usePrincipalModel.getDisplayName()
Old jalo generated method from GeneratedPrincipal - Getter of thePrincipal.displayName
jalo localized attribute.abstract java.lang.String
getDisplayName(SessionContext ctx)
Deprecated.since ages - usePrincipalModel.getDisplayName()
Old jalo generated method from GeneratedPrincipal - Getter of thePrincipal.displayName
jalo localized attribute.java.util.Set
getGlobalNegativePermissions()
Gets all negative permissions of this principal.java.util.Set
getGlobalPermissions(boolean negative)
Deprecated.java.util.Set
getGlobalPositivePermissions()
Gets all positive permissions of this principal.java.util.Set<PrincipalGroup>
getGroups(SessionContext ctx)
Gets all groups which this user belongs to.java.util.Map
getItemPermissionsMap(java.util.List userRights)
Returns all stored permissions for this principal and a given list of user rights.java.lang.String
getUid(SessionContext ctx)
Generated method - Getter of thePrincipal.uid
attribute.java.lang.String
getUID()
Deprecated.since ages - useGeneratedPrincipal.getUid()
insteadabstract boolean
isAdmin()
Checks whether the Principal is the admin user.boolean
isMemberOf(PrincipalGroup g)
Deprecated.since ages - useUserService.isMemberOfGroup(UserModel, UserGroupModel, boolean)
boolean
isMemberOf(PrincipalGroup grp, boolean includingSupergroups)
Deprecated.void
remove(SessionContext ctx)
SLDSafe - previously there was an intentional bug that deleted all the addresses after User was deleted - even those that are duplicates with the original field set.boolean
removeFromGroup(PrincipalGroup group)
Deprecated.since ages - useGeneratedPrincipal.removeFromGroups(SessionContext, PrincipalGroup)
insteadvoid
setGroups(SessionContext ctx, java.util.Set groups)
Sets the users memberships in the given groups.void
setItemPermissionsByMap(java.util.List userRights, java.util.Map permissionMap)
Changes all stored permissions for this principal and a given list of user rights at once.void
setUID(java.lang.String uid)
Deprecated.since ages - useGeneratedPrincipal.setUid(SessionContext, String)
insteadjava.lang.String
toString()
Returns theString
representation of this item.-
Methods inherited from class de.hybris.platform.jalo.security.GeneratedPrincipal
addToGroups, addToGroups, getDefaultAttributeModes, getDescription, getDescription, getGroups, getGroupsCount, getGroupsCount, getName, getName, getSearchRestrictions, getSearchRestrictions, getUid, isMarkModifiedDisabled, removeFromGroups, removeFromGroups, setDescription, setDescription, setGroups, setName, setName, setUid, setUid
-
Methods inherited from class de.hybris.platform.jalo.GenericItem
createItem, getImplementation, getInitialProperties, getNonInitialAttributes, getRelatedItems, setRelatedItems
-
Methods inherited from class de.hybris.platform.jalo.c2l.LocalizableItem
getAllLocalizedProperties, getAllLocalizedProperties, getAllLocalizedProperties, getAllLocalizedProperties, getAllValuesSessionContext, getLocalizedProperty, getLocalizedProperty, getLocalizedPropertyInternal, getLocalizedPropertyNames, getLocalizedPropertyNames, hasLanguage, isEmptyValue, isFallbackEnabled, removeLocalizedProperty, removeLocalizedProperty, setAllLocalizedProperties, setAllLocalizedProperties, setLocalizedProperty, setLocalizedProperty
-
Methods inherited from class de.hybris.platform.jalo.ExtensibleItem
createNonClassAccessor, getAllProperties, getAllProperties, getProperty, getProperty, getPropertyNames, getPropertyNames, removeProperty, removeProperty, setAllProperties, setAllProperties, setProperty, setProperty
-
Methods inherited from class de.hybris.platform.jalo.Item
addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addNegativePermission, addPermission, addPositivePermission, assureExtensionsLoaded, changeTypeAfterCreation, checkConstraint, checkItemPermission, checkMandatoryAttribute, checkMandatoryAttribute, checkPermission, checkPermission, checkRemovable, clearPermission, compareTo, ctx, doAfterRemove, doBeforeRemove, equals, getAccessorFor, getAllAttributes, getAllAttributes, getAllAttributes, getAllAttributes, getAllAttributesInternal, getAllLinkedItems, getAndCheckCacheBoundItem, getAttribute, getAttribute, getCacheBoundItem, getComposedType, getComposedTypePK, getCreationTime, getCurrentlyRemovingCount, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItemsCount, getLinkedItemsCount, getLinkedItemsCount, getModificationTime, getNegativePermissions, getOwner, getPermissionMap, getPermissions, getPersistenceVersion, getPK, getPositivePermissions, getRestrictedPrincipals, getSession, getSyncObject, getTenant, getTransientObject, getTransientObjectMap, hashCode, hasRegisteredClassAccessorFor, internal_registerClassAccessorFor, internal_registerNonClassAccessorFor, invalidateLocalCaches, isAlive, isCacheBound, isCurrentlyRemoving, isCurrentlyRemoving, isEmptyRelationValue, isInCreate, isInstanceOf, isItemCheckBeforeRemoveableDisabled, isRelationLocalizationFallbackEnabled, newInstance, notifyExtensionsAfterItemCreation, notifyExtensionsBeforeItemCreation, notifyItemRemoval, notifyManagerAboutItemRemoval, readResolve, registerAccessFor, registerAccessFor, registerJaloInvalidationListeners, remove, removeItemCollection, removeItemCollection, removeLinkedItems, removeLinkedItems, removeLinkedItems, removeLinkedItems, removeLinks, removePartOfItems, removePartOfItems, setAllAttributes, setAllAttributes, setAllAttributesInternal, setAllLinkedItems, setAllLinkedItems, setAllLinkedItems, setAllLinkedItems, setAttribute, setAttribute, setAttributeFromString, setAttributeFromString, setCacheBound, setComposedType, setCreationTime, setImplementation, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setModificationTime, setNonInitialAttributes, setOwner, setPermissionsByMap, setTransientObject, setUseTA, useTA, writeReplace
-
Methods inherited from class de.hybris.platform.util.BridgeAbstraction
setTenant
-
-
-
-
Field Detail
-
DISPLAYNAME
@Deprecated public static final java.lang.String DISPLAYNAME
Deprecated.since ages - it is a dynamic attribute nowConstant identifier fordisplayName
attribute of User type.- See Also:
- Constant Field Values
-
ALLSEARCHRESTRICTIONS
@Deprecated public static final java.lang.String ALLSEARCHRESTRICTIONS
Deprecated.since ages - it is a dynamic attribute nowConstant identifier forallSearchRestrictions
attribute of User type.- See Also:
- Constant Field Values
-
PRINCIPAL_GROUP_RELATION_NAME
@Deprecated public static final java.lang.String PRINCIPAL_GROUP_RELATION_NAME
Deprecated.since ages - use instead CoreConstants.Relations.PRINCIPALGROUPRELATIONConstant identifier forPrincipalGroupRelation
type.
-
ALLGROUPS
@Deprecated public static final java.lang.String ALLGROUPS
Deprecated.since ages - Old Jalo attribute that is now dynamic.- See Also:
- Constant Field Values
-
-
Method Detail
-
toString
public java.lang.String toString()
Description copied from class:Item
Returns theString
representation of this item. This is by default the representation of the primary key of this item.
-
getUID
@Deprecated public java.lang.String getUID()
Deprecated.since ages - useGeneratedPrincipal.getUid()
insteadGets the unique identifier of this principal.
-
checkConsistencyUid
protected void checkConsistencyUid(java.lang.String uid, java.lang.String message, java.lang.String composedTypeCode) throws ConsistencyCheckException
- Throws:
ConsistencyCheckException
-
getUid
public java.lang.String getUid(SessionContext ctx)
Description copied from class:GeneratedPrincipal
Generated method - Getter of thePrincipal.uid
attribute.- Overrides:
getUid
in classGeneratedPrincipal
- Returns:
- the uid
-
setUID
@Deprecated public void setUID(java.lang.String uid) throws ConsistencyCheckException
Deprecated.since ages - useGeneratedPrincipal.setUid(SessionContext, String)
insteadSets the uid of this principal.- Throws:
ConsistencyCheckException
- if there is already a principal with this id
-
checkSystemPrincipal
public abstract void checkSystemPrincipal() throws ConsistencyCheckException
- Throws:
ConsistencyCheckException
-
getGroups
public java.util.Set<PrincipalGroup> getGroups(SessionContext ctx)
Gets all groups which this user belongs to.- Overrides:
getGroups
in classGeneratedPrincipal
- Returns:
- a set of
PrincipalGroup
s the user is member in
-
getAllGroups
public java.util.Set<PrincipalGroup> getAllGroups()
-
getAllGroups
public java.util.Set<PrincipalGroup> getAllGroups(SessionContext ctx)
Gets all groups this principal is member of ( transitive ! ).- Returns:
- set of
PrincipalGroup
s this principal is member of ( transitive ! )
-
isMemberOf
@Deprecated public boolean isMemberOf(PrincipalGroup grp, boolean includingSupergroups)
Deprecated.Checks whether the principal is member of the given group or any of its subgroups.- Parameters:
includingSupergroups
- iftrue
indirect membership through group-in-group is evaluated, otherwise only direct membershipgrp
- the group to check membership for- Returns:
- true if this principal is member of the given group or any of its subgroups.
- See Also:
isMemberOf(PrincipalGroup)
-
setGroups
public void setGroups(SessionContext ctx, java.util.Set groups)
Sets the users memberships in the given groups.- Overrides:
setGroups
in classGeneratedPrincipal
- Parameters:
groups
- - the groups the user should be member in
-
addToGroup
@Deprecated public boolean addToGroup(PrincipalGroup group)
Deprecated.since ages - useGeneratedPrincipal.addToGroups(SessionContext, PrincipalGroup)
insteadAdds a group membership to this Principal.- Returns:
- true if the principal is not already member of the group
-
removeFromGroup
@Deprecated public boolean removeFromGroup(PrincipalGroup group)
Deprecated.since ages - useGeneratedPrincipal.removeFromGroups(SessionContext, PrincipalGroup)
insteadRemoves a group membership from this Principal.- Returns:
- true if the Principal was a member of this group
-
isMemberOf
@Deprecated public boolean isMemberOf(PrincipalGroup g)
Deprecated.since ages - useUserService.isMemberOfGroup(UserModel, UserGroupModel, boolean)
Checks whether this principal is direct member of the given group. supergroup membership is not evaluated.- Parameters:
g
- the group to check membership for- Returns:
- true if this principal is direct member of the given group. supergroup membership is not evaluated.
- See Also:
isMemberOf(PrincipalGroup, boolean)
-
getAllSearchRestrictions
public java.util.Collection<SearchRestriction> getAllSearchRestrictions()
Gets all search restrictions of this principal.- Returns:
- all search restrictions of this principal
-
getAllSearchRestrictions
public java.util.Collection<SearchRestriction> getAllSearchRestrictions(SessionContext ctx)
Gets all search restrictions of this principal.- Returns:
- all search restrictions of this principal
-
getItemPermissionsMap
public java.util.Map getItemPermissionsMap(java.util.List userRights)
Returns all stored permissions for this principal and a given list of user rights.The result map contains all items which this principal owns stored permissions for as keys, and a list of
Boolean
objects ordered according to the given user rights list. These objects have the following meaning:Boolean.TRUE
... a negative permission is storedBoolean.FALSE
... a positive permission is storednull
... no permission is stored for the according user right
Item.getPermissionMap(List)
.- Since:
- 2.10
-
setItemPermissionsByMap
public void setItemPermissionsByMap(java.util.List userRights, java.util.Map permissionMap)
Changes all stored permissions for this principal and a given list of user rights at once.The argument map must contain all items which this principal owns stored permissions for as keys, and a list of
Boolean
objects ordered according to the given user rights list. These objects have the following meaning:Boolean.TRUE
... a negative permission is storedBoolean.FALSE
... a positive permission is storednull
... no permission is stored for the according user right
Item.setPermissionsByMap(List, Map)
.- Since:
- 2.10
-
addGlobalPermission
@Deprecated public void addGlobalPermission(UserRight permission, boolean deny)
Deprecated.Adds a permission for this principal specifying if it is negative or positive.
-
addGlobalPermissions
@Deprecated public boolean addGlobalPermissions(java.util.Collection<PermissionContainer> permissions)
Deprecated.since ages - usePermissionManagementService.addGlobalPermissions(Collection)
-
addGlobalNegativePermission
@Deprecated public void addGlobalNegativePermission(UserRight permission)
Deprecated.Adds a negative permission for this principal.
-
addGlobalPositivePermission
@Deprecated public void addGlobalPositivePermission(UserRight permission)
Deprecated.Adds a positive permission for this principal.
-
clearGlobalPermission
@Deprecated public void clearGlobalPermission(UserRight permission)
Deprecated.Removes given permission for this principal.
-
clearGlobalPermissions
@Deprecated public boolean clearGlobalPermissions(java.util.Collection<PermissionContainer> permissions)
Deprecated.since ages - usePermissionManagementService.removeGlobalPermissions(Collection)
-
getGlobalPermissions
@Deprecated public java.util.Set getGlobalPermissions(boolean negative)
Deprecated.Gets all permissions of this principal specifying if they are all negative or positive.
-
getGlobalPositivePermissions
public java.util.Set getGlobalPositivePermissions()
Gets all positive permissions of this principal.
-
getGlobalNegativePermissions
public java.util.Set getGlobalNegativePermissions()
Gets all negative permissions of this principal.
-
getAllGlobalPositivePermissions
public java.util.Collection getAllGlobalPositivePermissions()
Gets all positive permissions of this principal including all positive permissions of groups the principal is member of.
-
getAllGlobalNegativePermissions
public java.util.Collection getAllGlobalNegativePermissions()
Gets all negative permissions of this principal including all negative permissions of groups the principal is member of.
-
isAdmin
public abstract boolean isAdmin()
Checks whether the Principal is the admin user.
-
checkOwnGlobalPermission
@Deprecated public int checkOwnGlobalPermission(PK userRightPK)
Deprecated.since ages - use(PrincipalModel, String)
-
checkGlobalPermission
@Deprecated public boolean checkGlobalPermission(UserRight right)
Deprecated.Checks whether the principal or a group the principal is member of has a postive permission for given right.
-
remove
public void remove(SessionContext ctx) throws ConsistencyCheckException
SLDSafe - previously there was an intentional bug that deleted all the addresses after User was deleted - even those that are duplicates with the original field set. Now addresses is a relation not an attribute andpartOf
takes care of deleting them.- Overrides:
remove
in classItem
- Parameters:
ctx
- A SessionContext object- Throws:
ConsistencyCheckException
-
getDisplayName
@Deprecated public abstract java.lang.String getDisplayName(SessionContext ctx)
Deprecated.since ages - usePrincipalModel.getDisplayName()
Old jalo generated method from GeneratedPrincipal - Getter of thePrincipal.displayName
jalo localized attribute.- Returns:
- the displayName
-
getDisplayName
@Deprecated public java.lang.String getDisplayName()
Deprecated.since ages - usePrincipalModel.getDisplayName()
Old jalo generated method from GeneratedPrincipal - Getter of thePrincipal.displayName
jalo localized attribute.- Returns:
- the displayName
-
getAllDisplayName
@Deprecated public abstract java.util.Map<Language,java.lang.String> getAllDisplayName(SessionContext ctx)
Deprecated.since agesOld jalo generated method from GeneratedPrincipal - Getter of thePrincipal.displayName
jalo localized attribute.- Returns:
- the localized displayName
-
getAllDisplayName
@Deprecated public java.util.Map<Language,java.lang.String> getAllDisplayName()
Deprecated.since agesOld jalo generated method from GeneratedPrincipal - Getter of thePrincipal.displayName
jalo localized attribute.- Returns:
- the localized displayName
-
-