Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
Public Member Functions | Public Attributes | List of all members
AuthItemForm Class Reference

Public Member Functions

 rules ()
 attributeLabels ()
 nameIsAvailable ($attribute, $params)
 newNameIsAvailable ($attribute, $params)
 isSuperuser ($attribute, $params)
 bizRuleNotEmpty ($attribute, $params)

Public Attributes

 $name
 $description
 $type
 $bizRule
 $data

Detailed Description

Authorization item form class file.

Author
Christoffer Niska cnisk.nosp@m.a@li.nosp@m.ve.co.nosp@m.m
Since
0.5

Definition at line 9 of file AuthItemForm.php.

Member Function Documentation

AuthItemForm::attributeLabels ( )

Declares attribute labels.

Definition at line 35 of file AuthItemForm.php.

References Rights\t().

{
return array(
'name' => Rights::t('core', 'Name'),
'description' => Rights::t('core', 'Description'),
'bizRule' => Rights::t('core', 'Business rule'),
'data' => Rights::t('core', 'Data'),
);
}
AuthItemForm::bizRuleNotEmpty (   $attribute,
  $params 
)

Makes sure that the business rule is not empty when data is specified. This is the 'bizRuleNotEmpty' validator as declared in rules().

Definition at line 80 of file AuthItemForm.php.

References Rights\t().

{
if( empty($this->data)===false && empty($this->bizRule)===true )
$this->addError('data', Rights::t('core', 'Business rule cannot be empty.'));
}
AuthItemForm::isSuperuser (   $attribute,
  $params 
)

Makes sure that the superuser roles name is not changed. This is the 'isSuperuser' validator as declared in rules().

Definition at line 70 of file AuthItemForm.php.

References Rights\module(), and Rights\t().

{
if( strtolower($_GET['name'])!==strtolower($this->name) && strtolower($_GET['name'])===strtolower(Rights::module()->superuserName) )
$this->addError('name', Rights::t('core', 'Name of the superuser cannot be changed.'));
}
AuthItemForm::nameIsAvailable (   $attribute,
  $params 
)

Makes sure that the name is available. This is the 'nameIsAvailable' validator as declared in rules().

Definition at line 49 of file AuthItemForm.php.

References Rights\getAuthorizer(), and Rights\t().

Referenced by newNameIsAvailable().

{
// Make sure that an authorization item with the name does not already exist
if( Rights::getAuthorizer()->authManager->getAuthItem($this->name)!==null )
$this->addError('name', Rights::t('core', 'An item with this name already exists.', array(':name'=>$this->name)));
}
AuthItemForm::newNameIsAvailable (   $attribute,
  $params 
)

Makes sure that the new name is available if the name been has changed. This is the 'newNameIsAvailable' validator as declared in rules().

Definition at line 60 of file AuthItemForm.php.

References nameIsAvailable().

{
if( strtolower(urldecode($_GET['name']))!==strtolower($this->name) )
$this->nameIsAvailable($attribute, $params);
}
AuthItemForm::rules ( )

Declares the validation rules.

Definition at line 20 of file AuthItemForm.php.

{
return array(
array('name, description', 'required'),
array('name', 'nameIsAvailable', 'on'=>'create'),
array('name', 'newNameIsAvailable', 'on'=>'update'),
array('name', 'isSuperuser', 'on'=>'update'),
array('data', 'bizRuleNotEmpty'),
array('bizRule, data', 'safe'),
);
}

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