Class Permission
java.lang.Object
com.foreach.across.modules.hibernate.business.SettableIdBasedEntity<Permission>
com.foreach.across.modules.user.business.Permission
- All Implemented Interfaces:
com.foreach.across.modules.hibernate.business.EntityWithDto<Permission>
,com.foreach.across.modules.hibernate.business.IdBasedEntity
,Serializable
,org.springframework.data.domain.Persistable<Long>
@Entity
public class Permission
extends com.foreach.across.modules.hibernate.business.SettableIdBasedEntity<Permission>
implements Serializable
A single permission that can be checked against.
Note that this class implements
GrantedAuthority
and can be used in Spring security
hasAuthority(String)
checks but not hasPermission()
checks. The latter in Spring security
refers to ACL based security.- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
authorityString
(String permissionName) Generate the authority string for a permission name.getGroup()
getId()
getName()
void
setDescription
(String description) void
setGroup
(PermissionGroup group) void
void
org.springframework.security.core.GrantedAuthority
Convert this permission to a Spring securityGrantedAuthority
for use in authentication.toString()
Methods inherited from class com.foreach.across.modules.hibernate.business.SettableIdBasedEntity
equals, getNewEntityId, hashCode, isNew, setNewEntityId, toDto
-
Constructor Details
-
Permission
public Permission() -
Permission
-
Permission
-
-
Method Details
-
getId
- Specified by:
getId
in interfacecom.foreach.across.modules.hibernate.business.IdBasedEntity
- Specified by:
getId
in interfaceorg.springframework.data.domain.Persistable<Long>
-
setId
- Specified by:
setId
in classcom.foreach.across.modules.hibernate.business.SettableIdBasedEntity<Permission>
-
getName
-
setName
-
getAuthority
-
getDescription
-
setDescription
-
getGroup
-
setGroup
-
toString
-
toGrantedAuthority
public org.springframework.security.core.GrantedAuthority toGrantedAuthority()Convert this permission to a Spring securityGrantedAuthority
for use in authentication.- Returns:
- granted authority
-
authorityString
Generate the authority string for a permission name. In this case the authority string is identical to the permission name. Method is provided to be in line withRole
andGroup
authorities.- Parameters:
permissionName
- name of the permission- Returns:
- authority string
-