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 ApiKeys

API Key management

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

Initialize the API Keys

Initialize the API Keys

Overrides

AppModel::__construct()
public integer
# auth( string $user, string $key )

Authenticates the given credentials and returns the company ID the API user has access to.

Authenticates the given credentials and returns the company ID the API user has access to.

Parameters

$user
The API user
$key
The API user's key

Returns

integer

The ID of the company the user belongs to, void if the credentials are invalid. Raises Input::errors() on error.

public array
# getList( integer $page = 1, array $order_by = ['date_created' => 'desc'] )

Returns a list of API keys

Returns a list of API keys

Parameters

$page
The page to fetch results on
$order_by
$order_by The sort and order conditions (e.g. ['sort_field' => "ASC"])

Returns

array
An array of stdClass objects
public integer
# getListCount( )

Returns a count of the number of results in a list of API keys

Returns a count of the number of results in a list of API keys

Returns

integer
The number of results in a list of API keys
public mixed
# get( integer $id )

Fetches the API key information for the given user

Fetches the API key information for the given user

Parameters

$id
The ID of the key to fetch

Returns

mixed
A stdClass object representing the API key, false if no such key exists
public
# add( array $vars )

Adds a new API key for the given company ID and user.

Adds a new API key for the given company ID and user.

Parameters

$vars

An array of API credential information including:

  • company_id The ID of the company to add the API key for
  • user The user to use as the API user
public
# edit( integer $id, array $vars )

Updates an API key

Updates an API key

Parameters

$id
The ID of the API key to edit
$vars

An array of API key data to update including:

  • notes Notes about this key
  • user The username of the API key
  • company_id The ID of the company the API key belongs to
public
# delete( integer $id )

Permanently removes an API key

Permanently removes an API key

Parameters

$id
The ID of the API key to delete
public string
# generateKey( string $key, integer $company_id )

Generates an API key using the company ID as a seed. Not intended to be invoked independently. See ApiKeys::add().

Generates an API key using the company ID as a seed. Not intended to be invoked independently. See ApiKeys::add().

Parameters

$key
The variable to set the key into
$company_id
The ID of the company to generate the key for

Returns

string
The generated key for the given company ID

See

ApiKeys::add()
public boolean
# validateUniqueUser( string $user, integer $company_id, integer $api_id = null )

Validates the given user is unique across all API keys for the given company

Validates the given user is unique across all API keys for the given company

Parameters

$user
The user to be validated against the given company
$company_id
The company ID to validate uniqueness across
$api_id
The ID of the API key (if given) to exclude from the uniqueness test

Returns

boolean
True if the user is unique for the given company (besides this $api_id), false otherwise
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