Package de.hybris.platform.jalo.security
Class Principal
- All Implemented Interfaces:
Serializable,Comparable
- Direct Known Subclasses:
GeneratedPrincipalGroup,GeneratedUser
This is the abstract base class of all hybris Platform users. Our security models allows to assign each principal a
set of
UserRights on one Item, which can be checked by the
AccessManager.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class de.hybris.platform.jalo.GenericItem
GenericItem.GenericItemImplNested classes/interfaces inherited from class de.hybris.platform.jalo.c2l.LocalizableItem
LocalizableItem.LocalizableItemImplNested classes/interfaces inherited from class de.hybris.platform.jalo.ExtensibleItem
ExtensibleItem.ExtensibleItemImplNested 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
FieldsModifier and TypeFieldDescriptionstatic final StringDeprecated.since ages - Old Jalo attribute that is now dynamic.static final StringDeprecated.since ages - it is a dynamic attribute nowstatic final StringDeprecated.since ages - it is a dynamic attribute nowstatic final StringDeprecated.since ages - use instead CoreConstants.Relations.PRINCIPALGROUPRELATIONFields 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, UIDFields inherited from class de.hybris.platform.jalo.c2l.LocalizableItem
LANGUAGE_FALLBACK_ENABLEDFields 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, TYPEFields inherited from class de.hybris.platform.util.BridgeAbstraction
impl, tenant -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddGlobalNegativePermission(UserRight permission) Deprecated.voidaddGlobalPermission(UserRight permission, boolean deny) Deprecated.booleanaddGlobalPermissions(Collection<PermissionContainer> permissions) Deprecated.since ages - usePermissionManagementService.addGlobalPermissions(Collection)voidaddGlobalPositivePermission(UserRight permission) Deprecated.booleanaddToGroup(PrincipalGroup group) Deprecated.since ages - useGeneratedPrincipal.addToGroups(SessionContext, PrincipalGroup)insteadprotected voidcheckConsistencyUid(String uid, String message, String composedTypeCode) booleancheckGlobalPermission(UserRight right) Deprecated.intcheckOwnGlobalPermission(PK userRightPK) Deprecated.since ages - use(PrincipalModel, String)abstract voidvoidclearGlobalPermission(UserRight permission) Deprecated.booleanclearGlobalPermissions(Collection<PermissionContainer> permissions) Deprecated.since ages - usePermissionManagementService.removeGlobalPermissions(Collection)Deprecated.since agesDeprecated.since agesGets all negative permissions of this principal including all negative permissions of groups the principal is member of.Gets all positive permissions of this principal including all positive permissions of groups the principal is member of.Gets all groups this principal is member of ( transitive ! ).Gets all search restrictions of this principal.Gets all search restrictions of this principal.Deprecated.since ages - usePrincipalModel.getDisplayName()Old jalo generated method from GeneratedPrincipal - Getter of thePrincipal.displayNamejalo localized attribute.abstract StringDeprecated.since ages - usePrincipalModel.getDisplayName()Old jalo generated method from GeneratedPrincipal - Getter of thePrincipal.displayNamejalo localized attribute.Gets all negative permissions of this principal.getGlobalPermissions(boolean negative) Deprecated.Gets all positive permissions of this principal.getGroups(SessionContext ctx) Gets all groups which this user belongs to.getItemPermissionsMap(List userRights) Returns all stored permissions for this principal and a given list of user rights.getUid(SessionContext ctx) Generated method - Getter of thePrincipal.uidattribute.getUID()Deprecated.since ages - useGeneratedPrincipal.getUid()insteadabstract booleanisAdmin()Checks whether the Principal is the admin user.booleanDeprecated.since ages - useUserService.isMemberOfGroup(UserModel, UserGroupModel, boolean)booleanisMemberOf(PrincipalGroup grp, boolean includingSupergroups) Deprecated.voidremove(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.booleanremoveFromGroup(PrincipalGroup group) Deprecated.since ages - useGeneratedPrincipal.removeFromGroups(SessionContext, PrincipalGroup)insteadvoidsetGroups(SessionContext ctx, Set groups) Sets the users memberships in the given groups.voidsetItemPermissionsByMap(List userRights, Map permissionMap) Changes all stored permissions for this principal and a given list of user rights at once.voidDeprecated.since ages - useGeneratedPrincipal.setUid(SessionContext, String)insteadtoString()Returns theStringrepresentation 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, setUidMethods inherited from class de.hybris.platform.jalo.GenericItem
createItem, getImplementation, getInitialProperties, getNonInitialAttributes, getRelatedItems, getRelatedItems, setRelatedItemsMethods 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, setLocalizedPropertyMethods inherited from class de.hybris.platform.jalo.ExtensibleItem
createNonClassAccessor, getAllProperties, getAllProperties, getProperty, getProperty, getPropertyNames, getPropertyNames, removeProperty, removeProperty, setAllProperties, setAllProperties, setProperty, setPropertyMethods 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, getPartOfRemovedSessionMarker, 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, suppressRelation, useTA, writeReplaceMethods inherited from class de.hybris.platform.util.BridgeAbstraction
setTenant
-
Field Details
-
DISPLAYNAME
Deprecated.since ages - it is a dynamic attribute nowConstant identifier fordisplayNameattribute of User type.- See Also:
-
ALLSEARCHRESTRICTIONS
Deprecated.since ages - it is a dynamic attribute nowConstant identifier forallSearchRestrictionsattribute of User type.- See Also:
-
PRINCIPAL_GROUP_RELATION_NAME
@Deprecated(since="ages", forRemoval=false) public static final String PRINCIPAL_GROUP_RELATION_NAMEDeprecated.since ages - use instead CoreConstants.Relations.PRINCIPALGROUPRELATIONConstant identifier forPrincipalGroupRelationtype. -
ALLGROUPS
Deprecated.since ages - Old Jalo attribute that is now dynamic.- See Also:
-
-
Constructor Details
-
Principal
public Principal()
-
-
Method Details
-
toString
Description copied from class:ItemReturns theStringrepresentation of this item. This is by default the representation of the primary key of this item. -
getUID
Deprecated.since ages - useGeneratedPrincipal.getUid()insteadGets the unique identifier of this principal. -
checkConsistencyUid
protected void checkConsistencyUid(String uid, String message, String composedTypeCode) throws ConsistencyCheckException - Throws:
ConsistencyCheckException
-
getUid
Description copied from class:GeneratedPrincipalGenerated method - Getter of thePrincipal.uidattribute.- Overrides:
getUidin classGeneratedPrincipal- Returns:
- the uid
-
setUID
@Deprecated(since="ages", forRemoval=false) public void setUID(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
- Throws:
ConsistencyCheckException
-
getGroups
Gets all groups which this user belongs to.- Overrides:
getGroupsin classGeneratedPrincipal- Returns:
- a set of
PrincipalGroups the user is member in
-
getAllGroups
-
getAllGroups
Gets all groups this principal is member of ( transitive ! ).- Returns:
- set of
PrincipalGroups this principal is member of ( transitive ! )
-
isMemberOf
@Deprecated(since="ages", forRemoval=false) 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- iftrueindirect 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:
-
setGroups
Sets the users memberships in the given groups.- Overrides:
setGroupsin classGeneratedPrincipal- Parameters:
groups- - the groups the user should be member in
-
addToGroup
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.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.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:
-
getAllSearchRestrictions
Gets all search restrictions of this principal.- Returns:
- all search restrictions of this principal
-
getAllSearchRestrictions
Gets all search restrictions of this principal.- Returns:
- all search restrictions of this principal
-
getItemPermissionsMap
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
Booleanobjects 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
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
Booleanobjects 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(since="ages", forRemoval=false) public void addGlobalPermission(UserRight permission, boolean deny) Deprecated.Adds a permission for this principal specifying if it is negative or positive. -
addGlobalPermissions
@Deprecated(since="ages", forRemoval=false) public boolean addGlobalPermissions(Collection<PermissionContainer> permissions) Deprecated.since ages - usePermissionManagementService.addGlobalPermissions(Collection) -
addGlobalNegativePermission
@Deprecated(since="ages", forRemoval=false) public void addGlobalNegativePermission(UserRight permission) Deprecated.Adds a negative permission for this principal. -
addGlobalPositivePermission
@Deprecated(since="ages", forRemoval=false) public void addGlobalPositivePermission(UserRight permission) Deprecated.Adds a positive permission for this principal. -
clearGlobalPermission
Deprecated.Removes given permission for this principal. -
clearGlobalPermissions
@Deprecated(since="ages", forRemoval=false) public boolean clearGlobalPermissions(Collection<PermissionContainer> permissions) Deprecated.since ages - usePermissionManagementService.removeGlobalPermissions(Collection) -
getGlobalPermissions
Deprecated.Gets all permissions of this principal specifying if they are all negative or positive. -
getGlobalPositivePermissions
Gets all positive permissions of this principal. -
getGlobalNegativePermissions
Gets all negative permissions of this principal. -
getAllGlobalPositivePermissions
Gets all positive permissions of this principal including all positive permissions of groups the principal is member of. -
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.since ages - use(PrincipalModel, String) -
checkGlobalPermission
Deprecated.Checks whether the principal or a group the principal is member of has a postive permission for given right. -
remove
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 andpartOftakes care of deleting them.- Overrides:
removein classItem- Parameters:
ctx- A SessionContext object- Throws:
ConsistencyCheckException
-
getDisplayName
@Deprecated(since="ages", forRemoval=false) public abstract String getDisplayName(SessionContext ctx) Deprecated.since ages - usePrincipalModel.getDisplayName()Old jalo generated method from GeneratedPrincipal - Getter of thePrincipal.displayNamejalo localized attribute.- Returns:
- the displayName
-
getDisplayName
Deprecated.since ages - usePrincipalModel.getDisplayName()Old jalo generated method from GeneratedPrincipal - Getter of thePrincipal.displayNamejalo localized attribute.- Returns:
- the displayName
-
getAllDisplayName
@Deprecated(since="ages", forRemoval=false) public abstract Map<Language,String> getAllDisplayName(SessionContext ctx) Deprecated.since agesOld jalo generated method from GeneratedPrincipal - Getter of thePrincipal.displayNamejalo localized attribute.- Returns:
- the localized displayName
-
getAllDisplayName
Deprecated.since agesOld jalo generated method from GeneratedPrincipal - Getter of thePrincipal.displayNamejalo localized attribute.- Returns:
- the localized displayName
-