models.delegates

Class Authorizable

lucee.Component
    extended by models.delegates.Authorizable

Copyright since 2016 by Ortus Solutions, Corp www.ortussolutions.com --- This delegate allows for objects to verify permissions and roles on the $parent This delegate expects the following functions to be exposed in the $parent and they must return an array of values - getPermissions() - getRoles() - getId()

Class Attributes:
  • synchronized : false
  •  
  • accessors : false
  •  
  • persistent : false
  •  
    Property Summary
    type property default serializable required
    any cbSecurity


    • access = public
    • returntype = any
    • inject = cbSecurity@cbSecurity
    true false
    Method Summary
    private array arrayWrap(any items)
         convert one or a list of permissions to an array, if it's an array we don't touch it.
    boolean hasAll(any permissions)
         Verify that ALL the permissions passed must exist within the authenticated user.
    boolean hasNone(any permissions)
         Verify that NONE of the permissions passed must exist within the authenticated user.
    boolean hasPermission(any permission)
         Verify if the parent has one or more of the passed in permissions.
    boolean hasRole(any role)
         Verify if the parent has one or more of the passed in roles.
    any isLoggedIn()
         Verify if the current user is logged in or not.
    boolean sameUser(any user)
         Verify that the passed in user object must be the same as the authenticated user.
     
    Methods inherited from class lucee.Component
    None

    Property Detail

    cbSecurity

    property any cbSecurity

    Attributes:
    access - public
    required - false
    returntype - any
    inject - cbSecurity@cbSecurity
    serializable - true

    Method Detail

    arrayWrap

    private array arrayWrap(any items)

    convert one or a list of permissions to an array, if it's an array we don't touch it

    Parameters:
    items - One, a list or an array
    Returns:
    An array

    hasAll

    public boolean hasAll(any permissions)

    Verify that ALL the permissions passed must exist within the authenticated user

    Parameters:
    permissions - One, a list or an array of permissions
    Throws:
    NoUserLoggedIn

    hasNone

    public boolean hasNone(any permissions)

    Verify that NONE of the permissions passed must exist within the authenticated user

    Parameters:
    permissions - One, a list or an array of permissions
    Throws:
    NoUserLoggedIn

    hasPermission

    public boolean hasPermission(any permission)

    Verify if the parent has one or more of the passed in permissions

    Parameters:
    permission - One or a list of permissions to check for access

    hasRole

    public boolean hasRole(any role)

    Verify if the parent has one or more of the passed in roles

    Parameters:
    role - One or a list of roles to check for access

    isLoggedIn

    public any isLoggedIn()

    Verify if the current user is logged in or not.


    sameUser

    public boolean sameUser(any user)

    Verify that the passed in user object must be the same as the authenticated user Equality is done by evaluating the `getid()` method on both objects.

    Parameters:
    user - The user to test for equality
    Throws:
    NoUserLoggedIn