Contentserv PHP API

CSCredentials
in package

This class defines the global Credentials API.

It provides multiple methods for the Credentials functionality.

Tags
since

PXC23.2

Table of Contents

createCredential()  : CSCredential
Creates a new credential api object based on the provided name
getCredentialForId()  : null|CSCredential
Returns the credential object matching the specified id
getCredentialForNameAndModule()  : null|CSCredential
Returns the credential object matching the specified name
getCredentials()  : array<string|int, mixed>
Returns a list of all credentials
getCredentialsForModule()  : array<string|int, mixed>
Returns a list of credentials for the specified module
getTokenForId()  : null|string
Returns the token for the credential with the specified id
getTokenForNameAndModule()  : null|string
Returns the token for the credential with the specified name
getTokenForRecord()  : null|string
Returns a credential value based on the Credentials API
storeCredential()  : bool
Stores a credential to the database.

Methods

createCredential()

Creates a new credential api object based on the provided name

public static createCredential(string $sName) : CSCredential
Parameters
$sName : string

The name of the credential to be created

Tags
access

public

Return values
CSCredential

The credential object with the prefilled name property

getCredentialForId()

Returns the credential object matching the specified id

public static getCredentialForId(int $iId) : null|CSCredential
Parameters
$iId : int

The id of the credential that should be returned.

Tags
access

public

Return values
null|CSCredential

The credential object, if found, otherwise null

getCredentialForNameAndModule()

Returns the credential object matching the specified name

public static getCredentialForNameAndModule(string $sName, string $sModule) : null|CSCredential
Parameters
$sName : string

The name of the credential that should be returned.

$sModule : string

The module of the credential that should be returned.

Tags
access

public

Return values
null|CSCredential

The credential object, if found, otherwise null

getCredentials()

Returns a list of all credentials

public static getCredentials() : array<string|int, mixed>
Tags
access

public

Return values
array<string|int, mixed>

List of credential api objects

getCredentialsForModule()

Returns a list of credentials for the specified module

public static getCredentialsForModule(string $sModule) : array<string|int, mixed>
Parameters
$sModule : string

The module name for which the credentials should be filtered.

Tags
access

public

Return values
array<string|int, mixed>

List of credential api objects matching the provided module.

getTokenForId()

Returns the token for the credential with the specified id

public static getTokenForId(int $iId) : null|string
Parameters
$iId : int

The id of the credential for which the token should be returned.

Tags
access

public

Return values
null|string

The token, if available, matching the credential with the specified id, otherwise null

getTokenForNameAndModule()

Returns the token for the credential with the specified name

public static getTokenForNameAndModule(string $sName, string $sModule) : null|string
Parameters
$sName : string

The name of the credential for which the token should be returned.

$sModule : string

The module of the credential for which the token should be returned.

Tags
access

public

Return values
null|string

The token, if available, matching the credential with the specified name, otherwise null

getTokenForRecord()

Returns a credential value based on the Credentials API

public static getTokenForRecord(Record $oRecord, string $sName) : null|string
Parameters
$oRecord : Record

the record where to retrieve the credential from

$sName : string

the name of the field where the credential is stored

Tags
public
Return values
null|string

The credential value for the requested name or null if there's no credential for that name

storeCredential()

Stores a credential to the database.

public static storeCredential(CSCredential $oCredentialApi) : bool
Parameters
$oCredentialApi : CSCredential

A credential api object that should be stored

Tags
access

public

Return values
bool

True, if storage was successful, otherwise false.


        

Search results