Class Credentials
Model implementing encrypted, generic credentials storage.
- CComponent
- CModel implements IteratorAggregate, ArrayAccess
- CActiveRecord
- Credentials
Author: Demitri Morgan <demitri@x2engine.com>
Located at x2engine/protected/models/Credentials.php
public
|
#
afterDelete( )
This method is invoked after deleting a record. The default implementation
raises the |
public
array
|
#
attributeLabels( )
Returns the attribute labels. Attribute labels are mainly used in error
messages of validation. By default an attribute label is generated using |
public
array
|
|
public
array
|
#
behaviors( )
Returns a list of behaviors that this model should behave as. The return value should be an array of behavior configurations indexed by behavior names. Each behavior configuration can be either a string specifying the behavior class or an array of the following structure: 'behaviorName'=>array( 'class'=>'path.to.BehaviorClass', 'property1'=>'value1', 'property2'=>'value2', ) |
public
|
#
afterSave( )
This method is invoked after saving a record successfully. The default
implementation raises the |
public
boolean
|
#
beforeDelete( )
This method is invoked before deleting a record. The default implementation
raises the |
public
|
#
defaultHooks( type $userId, mixed $serviceType )
Actions to take during setting of a default, especially when the default is system-wide. |
public
|
#
findDefault( type $userId, type $serviceType )
Returns the model with default credentials for a given type. |
public
type
|
|
public
type
|
|
public
type
|
|
public
|
|
public
|
|
public
|
#
getDefaultUserAccount( mixed $userId = null, mixed $type = 'email' )
Gets the default service record ID for the user of a given type. |
public
|
|
public
|
|
public
type
|
|
public
type
|
#
getServiceLabel( )
Obtains the service type label (UI-friendly name for the category of credentials) |
public
array
|
|
public
array
|
#
getSubstituteLabels( )
Gets a UI-friendly list of substitute classes to names for the current embedded model (i.e. for a selector of services for which the current credentials should be used as default) |
public
type
|
|
public static
array
|
#
getCredentialOptions( CModel $model, string $name, string $type = 'email', integer $uid = null, array $htmlOptions = array(), boolean $excludeLegacy = false, mixed $imapOnly = false )
|
public static
string
|
#
selectorField( CModel $model, string $name, string $type = 'email', integer $uid = null, array $htmlOptions = array(), array $excludeLegacy = false, array $imapOnly = false )
Generates a select input for a form that includes a list of credentials available for the current user. |
public
array
|
#
isDefaultOf( integer $uid )
Given a user id, returns an array of all service types for which the current record is default. |
public
|
#
makeDefault( type $userId, type $serviceType, mixed $hooks = true )
Set the default account for a given user to use for a given service. |
public static
static
|
|
public
array
|
|
public
string
|
__call(),
__construct(),
__get(),
__isset(),
__set(),
__sleep(),
__unset(),
addRelatedRecord(),
afterFind(),
afterFindInternal(),
applyScopes(),
attributeNames(),
beforeCount(),
beforeFind(),
beforeFindInternal(),
beforeSave(),
cache(),
count(),
countByAttributes(),
countBySql(),
defaultScope(),
delete(),
deleteAll(),
deleteAllByAttributes(),
deleteByPk(),
equals(),
exists(),
find(),
findAll(),
findAllByAttributes(),
findAllByPk(),
findAllBySql(),
findByAttributes(),
findByPk(),
findBySql(),
getActiveFinder(),
getActiveRelation(),
getAttribute(),
getAttributeLabel(),
getAttributes(),
getCommandBuilder(),
getDbConnection(),
getDbCriteria(),
getIsNewRecord(),
getMetaData(),
getOldPrimaryKey(),
getPrimaryKey(),
getRelated(),
getTableAlias(),
getTableSchema(),
hasAttribute(),
hasRelated(),
init(),
insert(),
instantiate(),
offsetExists(),
onAfterDelete(),
onAfterFind(),
onAfterSave(),
onBeforeCount(),
onBeforeDelete(),
onBeforeFind(),
onBeforeSave(),
populateRecord(),
populateRecords(),
primaryKey(),
query(),
refresh(),
refreshMetaData(),
resetScope(),
save(),
saveAttributes(),
saveCounters(),
scopes(),
setAttribute(),
setDbCriteria(),
setIsNewRecord(),
setOldPrimaryKey(),
setPrimaryKey(),
setTableAlias(),
together(),
update(),
updateAll(),
updateByPk(),
updateCounters(),
with()
|
addError(),
addErrors(),
afterConstruct(),
afterValidate(),
beforeValidate(),
clearErrors(),
createValidators(),
generateAttributeLabel(),
getError(),
getErrors(),
getIterator(),
getSafeAttributeNames(),
getScenario(),
getValidatorList(),
getValidators(),
hasErrors(),
isAttributeRequired(),
isAttributeSafe(),
offsetGet(),
offsetSet(),
offsetUnset(),
onAfterConstruct(),
onAfterValidate(),
onBeforeValidate(),
onUnsafeAttribute(),
setAttributes(),
setScenario(),
unsetAttributes(),
validate()
|
asa(),
attachBehavior(),
attachBehaviors(),
attachEventHandler(),
canGetProperty(),
canSetProperty(),
detachBehavior(),
detachBehaviors(),
detachEventHandler(),
disableBehavior(),
disableBehaviors(),
enableBehavior(),
enableBehaviors(),
evaluateExpression(),
getEventHandlers(),
hasEvent(),
hasEventHandler(),
hasProperty(),
raiseEvent()
|
integer |
LEGACY_ID
|
-1 |
#
When selecting a Credentials record: this as an ID indicates to use the (legacy) system default method. This should only ever be used in scenarios where "email" is the generic type of service being configured. |
integer |
SYS_ID
|
-1 |
#
When the userId of the record is set to this value, that denotes that it is available system-wide for generic tasks not tied to any one person. |
BELONGS_TO,
HAS_MANY,
HAS_ONE,
MANY_MANY,
STAT
|
public static
array
|
$sysUseAlias | array(
-1 => 'bulkEmail',
-2 => 'serviceCaseEmail',
-3 => 'systemResponseEmail',
-4 => 'systemNotificationEmail'
) |
#
Effectively the inverse map of |
public static
array
|
$sysUseId | array(
'bulkEmail' => -1,
'serviceCaseEmail' => -2,
'systemResponseEmail' => -3,
'systemNotificationEmail' => -4
) |
#
When selecting a user to set as the owner: values of this array as the userId field in the x2_credentials_default record indicate that it is it's owned by no one but can be used by anyone, and that it's the default for a particular usage that is generic (i.e. not tied to any one user), i.e. bulk email (which might typically use a non-personal address). |
public static
type
|
$sysUseTypes | array(
-1 => 'email',
-2 => 'email',
-3 => 'email',
-4 => 'email'
) |
#
For each system use type, define (as a comma-delineated list) the service type for that system use type. |
protected
array
|
$validModels | array(
'EmailAccount',
'GMailAccount',
'MandrillAccount',
'MailjetAccount',
'MailgunAccount',
'OutlookEmailAccount',
'SendgridAccount',
'SESAccount',
'YahooEmailAccount',
'TwitterApp',
'GoogleProject',
) |
#
Model classes to include/list as valid for storing auth data |
protected static
array
|
$imapModels | array(
'EmailAccount',
'GMailAccount',
'OutlookEmailAccount',
'YahooEmailAccount',
) |
#
Model classes which support the IMAP protocol |
$db
|
public
array
|
$authModelLabels |
#
(read-only) labels for embedded models; classes to display labels. |
public
array
|
$defaultCredentials |
#
(read-only) all credential default records indexed by user ID and service type |
public
array
|
$defaultSubstitutes |
#
(read-only) a map of service types to valid embedded classes for storing data for that service. For example, the Google account model can be used for sending email just as well as the generic email account model, so it would need to be included among a list of credentials to use as the default email account. |
public
array
|
$defaultSubstitutesInv |
#
(read-only) Like defaultSubstitutes but "inverted"; displays, for a given model class, the list of service types for which it can act as a stand-in. |
public
boolean
|
$isInUseBySystem |
#
(read-only) indicates whether the attribute is being used for some system-wide/generic task. |
public
array
|
$serviceLabels |
#
(read-only) An array of UI-friendly names for service keyworkds, i.e. "Email Account" for "email". |
public
array
|
$sysUseLabels |
#
(read-only) An array of labels for system-wide uses of system-owned credentials. |
$attributes,
$commandBuilder,
$dbConnection,
$dbCriteria,
$isNewRecord,
$metaData,
$oldPrimaryKey,
$primaryKey,
$tableAlias,
$tableSchema
|
$errors,
$iterator,
$safeAttributeNames,
$scenario,
$validatorList,
$validators
|