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 Details

    • Permission

      public Permission()
    • Permission

      public Permission(String name)
    • Permission

      public Permission(String name, String description)
  • Method Details

    • getId

      public Long getId()
      Specified by:
      getId in interface com.foreach.across.modules.hibernate.business.IdBasedEntity
      Specified by:
      getId in interface org.springframework.data.domain.Persistable<Long>
    • setId

      public void setId(Long id)
      Specified by:
      setId in class com.foreach.across.modules.hibernate.business.SettableIdBasedEntity<Permission>
    • getName

      public String getName()
    • setName

      public void setName(String name)
    • getAuthority

      public String getAuthority()
    • getDescription

      public String getDescription()
    • setDescription

      public void setDescription(String description)
    • getGroup

      public PermissionGroup getGroup()
    • setGroup

      public void setGroup(PermissionGroup group)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toGrantedAuthority

      public org.springframework.security.core.GrantedAuthority toGrantedAuthority()
      Convert this permission to a Spring security GrantedAuthority for use in authentication.
      Returns:
      granted authority
    • authorityString

      public static String authorityString(String permissionName)
      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 with Role and Group authorities.
      Parameters:
      permissionName - name of the permission
      Returns:
      authority string