Class flApiKeyMgr
flApiKeyMgr Class
Class to generate and manage API keys.
Package: fusionLib
Copyright:
Copyright (c) 2013 fusionLib. All rights reserved.
Located at system/libs/Api/flApiKeyMgr.php
Methods summary
public
|
#
__construct( flDb $db )
Create the object.
Parameters
- $db
- The database object to use.
|
public
array
|
#
getKeys( )
Get all the keys in the system and their descriptions.
Get all the keys in the system and their descriptions.
Returns
array Array of keys to descriptions.
|
public
boolean|string
|
#
createKey( string $desc )
Create a new API Key.
Parameters
- $desc
- The description for the key.
Returns
boolean|string The API key or false if failed.
|
public
string
|
#
getKeyDesc( string $key )
Get the description of an API Key.
Get the description of an API Key.
Parameters
- $key
- The key to get the description for.
Returns
string The description.
|
public
array
|
#
getKeyRoles( string $key )
Get the roles assigned to a key.
Get the roles assigned to a key.
Parameters
- $key
- The key to get the roles for.
Returns
array Array of assigned roles.
|
public
|
#
setKeyRoles( string $key, array $roles )
Set the roles assigned to a key.
Set the roles assigned to a key.
Parameters
- $key
- The key to assign roles to.
- $roles
- Array of role IDs to assign to the key.
|
public
boolean
|
#
updateKeyDesc( string $key, string $desc )
Update the description of an API key.
Update the description of an API key.
Parameters
- $key
- The key to update.
- $desc
- The new description for the key.
Returns
boolean true if updated; else false.
|
public
boolean
|
#
deleteKey( string $key )
Delete an API Key.
Parameters
Returns
boolean true if the key deleted; else false.
|