Blesta
  • Package
  • Class
  • Tree
  • Deprecated

Packages

  • blesta
    • app
      • controllers
      • models
    • components
      • areyouahuman
      • auth
        • motp
        • oath
      • delivery
        • interfax
        • postal
          • methods
      • download
      • email
      • events
        • default
      • exchange
        • rates
          • google
            • finance
          • yahoo
            • finance
      • gateway
        • payments
      • gateways
      • invoice
        • delivery
        • templates
          • quickbooks
            • invoice
      • json
      • modules
      • net
        • amazon
          • s3
        • http
        • net
          • geo
            • ip
      • plugins
      • recaptcha
      • reports
        • aging
          • invoices
        • custom
          • report
        • invoice
          • creation
        • tax
          • liability
        • transactions
          • applied
          • received
      • security
      • session
        • cart
      • settingscollection
      • upgrades
        • tasks
      • upload
      • vcard
    • helpers
      • currency
        • format
      • data
        • structure
          • array
          • string
      • text
        • parser
      • widget
        • client
  • minPHP
    • components
      • input
      • record
    • helpers
      • color
      • data
        • structure
      • date
      • form
      • html
      • javascript
      • xml
    • lib
  • None
  • PHP

Classes

  • Accounts
  • ApiKeys
  • CalendarEvents
  • ClientGroups
  • Clients
  • Companies
  • Contacts
  • Countries
  • Coupons
  • CronTasks
  • Currencies
  • EmailGroups
  • Emails
  • Encryption
  • GatewayManager
  • Invoices
  • InvoiceTemplateManager
  • Languages
  • Logs
  • Marketplace
  • ModuleClientMeta
  • ModuleManager
  • Navigation
  • PackageGroups
  • PackageOptionGroups
  • PackageOptions
  • Packages
  • Payments
  • Permissions
  • PluginManager
  • Pricings
  • ReportManager
  • ServiceChanges
  • Services
  • Settings
  • Staff
  • StaffGroups
  • States
  • Taxes
  • Themes
  • Transactions
  • Users

Class ApiKeys

API Key management

Model
Extended by AppModel
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( )

The main app model constructor.

The main app model constructor.

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
string
$user The API user
$key
string
$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 = array('date_created'=>"desc") )

Returns a list of API keys

Returns a list of API keys

Parameters

$page
integer
$page The page to fetch results on
$order_by
array
$order_by $order_by The sort and order conditions (e.g. array('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
integer
$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
array
$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
integer
$id The ID of the API key to edit
$vars
array
$var 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
integer
$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
string
$key The variable to set the key into
$company_id
integer
$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
string
$user The user to be validated against the given company
$company_id
integer
$company_id The company ID to validate uniqueness across
$api_id
integer
$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 inherited from Model

affectedRows(), begin(), commit(), getConnection(), lastInsertId(), makeDSN(), prepare(), query(), rollBack(), setAttribute(), setFetchMode()

Magic methods summary

Properties summary

Properties inherited from AppModel

$replacement_keys

Blesta API documentation generated by ApiGen 2.8.0