Credio Client for PHP
Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
Credio\Client Class Reference

provides Client API for working with Credio server. More...

Public Member Functions

 setCallback ($errorCode, $handler)
 set callback $handler More...
 
 removeCallback ($errorCode, $handler)
 remove callback $handler More...
 
 haveToken ()
 
 getPermissions ($path, $token=null)
 get permissions by path More...
 
 getAttributes ($path, $token=null)
 get attributes by $path More...
 
 attrInsert ($target, $targetType, Attribute &$attribute, $token=NULL)
 create new Attribute. More...
 
 attrEdit ($target, $targetType, $attribute, $token=NULL)
 change Attribute. More...
 
 attrRemove ($target, $targetType, $attribute, $token=NULL)
 remove Attribute More...
 
 authenticate ($username, $password)
 used to verify user credentials. More...
 
 getToken ($username, $password)
 used to obtain Token from Credio server. More...
 
 releaseToken ($token=NULL)
 used to release Token from Credio server. More...
 
 isValidToken ($token=NULL)
 check whether Token is valid or not on Credio server. More...
 
 userSearch ($pattern, $token=NULL, $opt=NULL)
 searching for Users matching pattern. More...
 
 userInsert ($username, $password, $token=NULL)
 create new User. More...
 
 userEdit (User $user, $token=NULL)
 change User. More...
 
 userRemove (User $user, $token=NULL)
 remove User. More...
 
 groupSearch ($pattern, $token=NULL, $opt=NULL)
 searching for Groups matching pattern. More...
 
 groupInsert ($group, $token=NULL)
 create new Group. More...
 
 groupEdit (Group $group, $token=NULL)
 change Group. More...
 
 groupRemove (Group $group, $token=NULL)
 remove Group. More...
 

Static Public Member Functions

static getInstance ($domain=Client::defaultDomain)
 create new Client instance. More...
 
static getCookieInstance ($domain, &$cookies=NULL)
 create new Client instance with HTTP Cookie support. More...
 
static getCookieSsoPortalInstance ($domain, &$cookies=NULL)
 create new Client instance with HTTP Cookie support. More...
 

Public Attributes

 $IsCacheEnabled = true
 
 $IsExceptionEnabled = true
 if true Client will throw exceptions More...
 
 $CredioServerURL = "https://10.60.0.44"
 
 $domain
 domain More...
 
 $token = NULL
 token within Client class. More...
 
const defaultDomain = "CREDIO"
 

Private Member Functions

 __construct ($domain)
 
 createDom ()
 create DOM document with root tag element for Credio API More...
 
 createApiElement ($dom, $api, $token)
 create DOM element for API. More...
 
 validateToken ($token)
 validate $token More...
 
 _send_xml_req ($xml)
 
 netGetResponse (&$domOut)
 
 navigateToSsoPortal ($loginPortalUri=null)
 navigate browser to Sso portal. More...
 

Private Attributes

 $cachePerm = array()
 
 $cacheAttr = array()
 
 $isCookieInstance = false
 determine whether this instance is created with cookie support. More...
 
 $cookies = NULL
 used to store PHP _COOKIE variable More...
 
 $cookieName = "CREDIO_TOKEN"
 name for cookie stored in client browser More...
 
 $errorCallbacks = array()
 callback handlers More...
 

Detailed Description

provides Client API for working with Credio server.

Constructor & Destructor Documentation

Credio\Client::__construct (   $domain)
private

Member Function Documentation

Credio\Client::_send_xml_req (   $xml)
private
Credio\Client::attrEdit (   $target,
  $targetType,
  $attribute,
  $token = NULL 
)

change Attribute.

check Credio API attrEdit for full specification

Parameters
$target
$targetType
$attribute
null$token
Exceptions
Exception
Returns
bool
Credio\Client::attrInsert (   $target,
  $targetType,
Attribute $attribute,
  $token = NULL 
)

create new Attribute.

check Credio API attrInsert for full specification

Parameters
$target
$targetType
Attribute$attribute
null$token
Exceptions
Exception
Returns
bool | Attribute
Credio\Client::attrRemove (   $target,
  $targetType,
  $attribute,
  $token = NULL 
)

remove Attribute

check Credio API attrRemove for full specification

Parameters
$target
$targetType
$attribute
null$token
Exceptions
Exception
Returns
bool
Credio\Client::authenticate (   $username,
  $password 
)

used to verify user credentials.

check Credio API authenticate for full specification

Parameters
$username
$password
Exceptions
Exception
Returns
bool
Credio\Client::createApiElement (   $dom,
  $api,
  $token 
)
private

create DOM element for API.

Parameters
$dom
$api
$token
Returns
DOMElement
Credio\Client::createDom ( )
private

create DOM document with root tag element for Credio API

Returns
DOMDocument
Credio\Client::getAttributes (   $path,
  $token = null 
)

get attributes by $path

check Credio API getAttributes for full specification

Parameters
$path
null$token
Exceptions
Exception
Returns
Attribute[]
static Credio\Client::getCookieInstance (   $domain,
$cookies = NULL 
)
static

create new Client instance with HTTP Cookie support.

Cookie support will automatically set cookie on client browser on Client::getToken method, and will remove cookie on Client::releaseToken method.

Parameters
string$domain
PHP_COOKIE$cookies
Exceptions
Exception
Returns
Client
static Credio\Client::getCookieSsoPortalInstance (   $domain,
$cookies = NULL 
)
static

create new Client instance with HTTP Cookie support.

same as Client::getCookieInstance, but will automatically redirect to SSO portal, if session is not yet authenticated.

Parameters
$domain
$cookiesPHP _COOKIE variable
Exceptions
Exception
Returns
Client
static Credio\Client::getInstance (   $domain = Client::defaultDomain)
static

create new Client instance.

Parameters
string$domain
Returns
Client
Credio\Client::getPermissions (   $path,
  $token = null 
)

get permissions by path

check Credio API getPermissions for full specification

Parameters
$path
null$token
Exceptions
Exception
Returns
Permission[]
Credio\Client::getToken (   $username,
  $password 
)

used to obtain Token from Credio server.

check Credio API getToken for full specification

Parameters
$username- username
$password- password
Exceptions
Exception
Returns
Token
Credio\Client::groupEdit ( Group  $group,
  $token = NULL 
)

change Group.

check Credio API groupEdit for full specification

Parameters
Group$group
null$token
Exceptions
Exception
Returns
bool | Group
Credio\Client::groupInsert (   $group,
  $token = NULL 
)

create new Group.

check Credio API groupInsert for full specification

Parameters
string  |  Group$group
null$token
Exceptions
Exception
Returns
bool | Group
Credio\Client::groupRemove ( Group  $group,
  $token = NULL 
)

remove Group.

check Credio API groupRemove for full specification

Parameters
Group$group
null$token
Exceptions
Exception
Returns
bool
Credio\Client::groupSearch (   $pattern,
  $token = NULL,
  $opt = NULL 
)

searching for Groups matching pattern.

check Credio API groupSearch for full specification

Parameters
$pattern- regex pattern
$token
$opt- options for search
Exceptions
Exception
Returns
Group[]
Credio\Client::haveToken ( )
Credio\Client::isValidToken (   $token = NULL)

check whether Token is valid or not on Credio server.

using isValidToken API will couse Credio server to reset Token expire timer. check Credio API isValidToken for full specification

Parameters
[in]$token- if not present Client::$token is used.
Exceptions
Exception
Returns
Boolean true if $token is valid on Credio server.
Credio\Client::navigateToSsoPortal (   $loginPortalUri = null)
private

navigate browser to Sso portal.

Sso portal URL address is obtained from Credio domain

Parameters
null$loginPortalUri
Exceptions
Exception
Returns
bool
Credio\Client::netGetResponse ( $domOut)
private
Credio\Client::releaseToken (   $token = NULL)

used to release Token from Credio server.

check Credio API releaseToken for full specification

Parameters
$token- token to release. if not set Client::$token is used.
Exceptions
Exception
Returns
boolean
Credio\Client::removeCallback (   $errorCode,
  $handler 
)

remove callback $handler

Parameters
$errorCode
$handler
Credio\Client::setCallback (   $errorCode,
  $handler 
)

set callback $handler

Parameters
$errorCode
$handler
Credio\Client::userEdit ( User  $user,
  $token = NULL 
)

change User.

check Credio API userEdit for full specification

Parameters
User$user
null$token
Exceptions
Exception
Returns
bool | User
Credio\Client::userInsert (   $username,
  $password,
  $token = NULL 
)

create new User.

check Credio API userInsert for full specification

Parameters
$username
$password
null$token
Exceptions
Exception
Returns
bool | User
Credio\Client::userRemove ( User  $user,
  $token = NULL 
)

remove User.

check Credio API userRemove for full specification

Parameters
User$user
null$token
Exceptions
Exception
Returns
bool
Credio\Client::userSearch (   $pattern,
  $token = NULL,
  $opt = NULL 
)

searching for Users matching pattern.

check Credio API userSearch for full specification

Parameters
$pattern- regex pattern
$token
$opt- options for search
Exceptions
Exception
Returns
User[]
Credio\Client::validateToken (   $token)
private

validate $token

if $token is not set, function replaces $token with $this->token

Parameters
$token
Exceptions
Exception
Returns
null

Member Data Documentation

Credio\Client::$cacheAttr = array()
private
Credio\Client::$cachePerm = array()
private
Credio\Client::$cookieName = "CREDIO_TOKEN"
private

name for cookie stored in client browser

Credio\Client::$cookies = NULL
private

used to store PHP _COOKIE variable

Credio\Client::$CredioServerURL = "https://10.60.0.44"
Credio\Client::$domain

domain

Credio\Client::$errorCallbacks = array()
private

callback handlers

Credio\Client::$IsCacheEnabled = true
Credio\Client::$isCookieInstance = false
private

determine whether this instance is created with cookie support.

Credio\Client::$IsExceptionEnabled = true

if true Client will throw exceptions

Credio\Client::$token = NULL

token within Client class.

const Credio\Client::defaultDomain = "CREDIO"

The documentation for this class was generated from the following file: