Overview

Packages

  • blesta
    • app
      • controllers
      • models
    • components
      • auth
        • ldap
        • motp
        • oath
      • delivery
        • interfax
        • postal
          • methods
      • download
      • email
      • events
      • exchange
        • rates
          • currency
            • layer
          • fixer
          • open
            • exchange
              • rates
          • x
            • rates
      • gateway
        • payments
      • gateways
      • invoice
        • delivery
        • templates
          • perforated
            • invoice
          • quickbooks
            • invoice
          • templates
            • default
      • modules
      • net
        • amazon
          • s3
        • http
        • net
          • geo
            • ip
      • plugins
      • reports
        • aging
          • invoices
        • client
          • data
            • portability
        • custom
          • report
        • invoice
          • creation
        • package
          • revenue
        • tax
          • liability
        • transactions
          • applied
          • received
      • security
      • session
        • cart
      • settingscollection
      • upgrades
        • tasks
      • upload
      • vcard
    • core
      • Automation
        • Tasks
          • Common
          • Task
        • Type
          • Common
          • Cron
      • Pricing
        • ItemComparator
        • MetaItem
        • Modifier
          • Type
            • Description
              • Type
                • Discount
                • Option
                • Service
                • Tax
            • Discount
            • Price
            • Proration
        • Presenter
          • Build
            • Invoice
            • InvoiceData
            • Options
            • Service
            • ServiceChange
            • ServiceData
          • Collection
          • Format
            • Fields
            • Type
              • Discount
              • Item
              • Option
              • Options
              • Package
              • Pricing
              • Service
              • Tax
          • Items
            • Invoice
            • Service
          • Type
      • ServiceProviders
      • Util
        • Captcha
          • Captchas
          • Common
        • Common
          • Traits
        • Events
          • Common
          • Handlers
          • Observers
        • Filters
          • Common
        • GeoIp
        • Input
          • Fields
            • Common
        • Tax
        • Widgets
    • helpers
      • currency
        • format
      • data
        • structure
          • array
          • string
      • text
        • parser
      • widget
        • client
  • minPHP
    • helpers
      • color
      • data
        • structure
  • None
  • PHP

Classes

  • Accounts
  • Actions
  • ApiKeys
  • Backup
  • CalendarEvents
  • ClientGroups
  • Clients
  • Companies
  • Contacts
  • Countries
  • Coupons
  • CouponTerms
  • CronTasks
  • Currencies
  • EmailGroups
  • Emails
  • EmailVerifications
  • Encryption
  • GatewayManager
  • Invoices
  • InvoiceTemplateManager
  • Languages
  • Logs
  • Marketplace
  • MessageGroups
  • Messages
  • MessengerManager
  • ModuleClientMeta
  • ModuleManager
  • ModuleTypes
  • Navigation
  • PackageGroups
  • PackageOptionGroups
  • PackageOptions
  • Packages
  • Payments
  • Permissions
  • PluginManager
  • Pricings
  • ReportManager
  • ServiceChanges
  • ServiceInvoices
  • Services
  • Settings
  • Staff
  • StaffGroups
  • States
  • SystemEvents
  • Taxes
  • Themes
  • Transactions
  • Users
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated

Class Permissions

Permissions management

Controls which options are available for setting the Access Control List's Control Objects as well as offers an interface for interacting with the ACL

Model
Extended by AppModel uses Blesta\Core\Util\Common\Traits\Container
Extended by Permissions
Package: blesta\app\models
Copyright: Copyright (c) 2010, Phillips Data, Inc.
License: The Blesta License Agreement
Link: Blesta
Located at app/models/permissions.php
Methods summary
public
# __construct( )

Loads the ACL for processing

Loads the ACL for processing

Overrides

AppModel::__construct()
public mixed
# get( integer $id )

Fetches the given permission record from the database by ID

Fetches the given permission record from the database by ID

Parameters

$id
The permission ID to fetch

Returns

mixed
A stdClass object representing a permission field, false if the permission field does not exist
public mixed
# getByAlias( string $alias, integer $plugin_id = null, string $action = null )

Fetches the given permission record from the database by alias

Fetches the given permission record from the database by alias

Parameters

$alias
The permission alias to fetch
$plugin_id
The ID of the plugin (null if not part of a plugin) the alias belongs to
$action
The permission action to fetch (null fetches 1st match on alias)

Returns

mixed
A stdClass object representing a permission field, false if the permission field does not exist
public mixed
# getGroup( integer $group_id )

Fetches the given permission group record from the database by ID

Fetches the given permission group record from the database by ID

Parameters

$group_id
The permission group ID to fetch

Returns

mixed
A stdClass object representing a permission group, false if the permission group does not exist
public mixed
# getGroupByAlias( string $group_alias, integer $plugin_id = null )

Fetches the given permission group record from the database by alias

Fetches the given permission group record from the database by alias

Parameters

$group_alias
The permission group alias to fetch
$plugin_id
The ID of the plugin (null if not part of a plugin) the alias belongs to

Returns

mixed
A stdClass object representing a permission group, false if the permission group does not exist
public array
# getAll( string $level, integer $company_id )

Fetches all permission fields divided under each permission category.

Fetches all permission fields divided under each permission category.

Parameters

$level
The level to fetch permissions for ('staff', or 'client')
$company_id
The company to fetch permissions for

Returns

array

An array of stdClass objects each representing a permission group. Each permission group also contains an array of permission fields representing as stdClass objects

public stdClass
# fromAcl( string $aro, string $level, integer $company_id )

Fetches a set of permission groups and permission fields that the given group has access to on the provided level and company

Fetches a set of permission groups and permission fields that the given group has access to on the provided level and company

Parameters

$aro
The ARO to fetch permissions for
$level
The level to fetch permissions for ('staff' or 'client')
$company_id
The ID of the company to fetch permissions for

Returns

stdClass

A stdClass object containing the following:

  • permission_group An numerically indexed array of permission group IDs that this ARO is allowed to access
  • permission A numerically indexed array of permission field IDs that this ARO is allowed to access
public boolean
# authorized( string $aro, string $aco, string $action, string $level, integer $company_id )

Verifies whether the given ARO is authorized to access the given ACO on the given action

Verifies whether the given ARO is authorized to access the given ACO on the given action

Parameters

$aro
The ARO to verify can access the ACO
$aco
The ACO to verify can be accessed by the ARO
$action
The action permission
$level
The permission group level
$company_id
The ID of the company

Returns

boolean

True if the ARO is authorized to access the ACO or if the permission or permission group does not exist, false otherwise

public integer
# add( array $vars )

Adds a new permission field to the system (also adds the permission to the ACL)

Adds a new permission field to the system (also adds the permission to the ACL)

Parameters

$vars

An array of input fields including:

  • group_id The ID of the permission group this permission belongs to
  • name The name of this permission (language definition or plain-text)
  • alias The ACO alias for this permission (i.e. the Class name to apply to)
  • action The action this ACO may control (i.e. the Method name of the alias to control access for)
  • plugin_id The ID of the plugin this action belongs to (if any)

Returns

integer
The ID of the permission record on success, void one error
public
# edit( integer $id, array $vars )

Updates the permission field in the system (also adds the permission to the ACL if needed)

Updates the permission field in the system (also adds the permission to the ACL if needed)

Parameters

$id
The ID of the permission field to update
$vars

An array of input fields including:

  • group_id The ID of the permission group this permission belongs to
  • name The name of this permission (language definition or plain-text)
  • alias The ACO alias for this permission (i.e. the Class name to apply to)
  • action The action this ACO may control (i.e. the Method name of the alias to control access for)
  • plugin_id The ID of the plugin this action belongs to (if any)
public
# delete( integer $id )

Deletes the permission field from the system, also removes the items from the ACL

Deletes the permission field from the system, also removes the items from the ACL

Parameters

$id
The ID of the permission field to delete
public integer
# addGroup( array $vars )

Adds a new permission group to the system (also adds the permission to the ACL)

Adds a new permission group to the system (also adds the permission to the ACL)

Parameters

$vars

An array of input fields including:

  • name The name of this permission group (language definition or plain-text)
  • level The level this permission group resides on (staff or client)
  • alias The ACO alias for this permission group (i.e. the Class name to apply to)
  • plugin_id The ID of the plugin this permission group belongs to (if any)

Returns

integer
The ID of the permission group on success, void one error
public
# editGroup( integer $group_id, array $vars )

Updates the permission group in the system (also adds the permission to the ACL if needed)

Updates the permission group in the system (also adds the permission to the ACL if needed)

Parameters

$group_id
The ID of the permission group to update
$vars

An array of input fields including:

  • name The name of this permission group (language definition or plain-text)
  • level The level this permission group resides on (staff or client)
  • alias The ACO alias for this permission group (i.e. the Class name to apply to)
  • plugin_id The ID of the plugin this permission group belongs to (if any)
public
# deleteGroup( integer $group_id )

Deletes the permission group from the system, also removes the items from the ACL

Deletes the permission group from the system, also removes the items from the ACL

Parameters

$group_id
The ID of the permission group to delete
Methods inherited from AppModel
_(), boolToInt(), currencyToDecimal(), dateToUtc(), errors(), getPerPage(), ifSet(), loadCrypto(), setDefaultIfEmpty(), setPerPage(), setRulesIfSet(), strToBool(), systemDecrypt(), systemEncrypt(), systemHash(), truncateDecimal(), validateExists(), validateStateCountry()
Methods used from Blesta\Core\Util\Common\Traits\Container
getFromContainer()
Properties inherited from AppModel
$logger, $replacement_keys
Blesta API documentation generated by ApiGen