/**
  * PasswordExpiry handles both
  * POLICY_PASSWORD_EXPIRES and POLICY_PASSWORD_EXPIRY_DAYS
  */
 public function getFormRules()
 {
     $attributeName1 = FormModelUtil::getDerivedAttributeNameFromTwoStrings($this->moduleName, 'POLICY_PASSWORD_EXPIRES');
     $attributeName2 = FormModelUtil::getDerivedAttributeNameFromTwoStrings($this->moduleName, $this->policy);
     $rules = array(array($attributeName1, 'type', 'type' => 'integer'), array($attributeName2, 'type', 'type' => 'integer'), array($attributeName2, 'length', 'max' => 3), array($attributeName2, 'validateIsRequiredByComparingHelper', 'compareAttributeName' => 'UsersModule__POLICY_PASSWORD_EXPIRES'));
     if (!empty($this->inherited)) {
         $rules[] = array($attributeName2, 'numerical', 'max' => $this->inherited);
     }
     return $rules;
 }
Example #2
0
 protected static function getElementInformation($moduleName, $right, $rightInformation)
 {
     if ($rightInformation['inherited'] == Right::DENY) {
         $type = 'RightInheritedDenyText';
     } elseif ($rightInformation['inherited'] == Right::ALLOW && $rightInformation['explicit'] == null) {
         $type = 'RightInheritedAllowStaticDropDown';
     } else {
         $type = 'RightStaticDropDown';
     }
     $element = array('attributeName' => FormModelUtil::getDerivedAttributeNameFromTwoStrings($moduleName, $right), 'type' => $type);
     return $element;
 }
 public function getFormRules()
 {
     $attributeName = FormModelUtil::getDerivedAttributeNameFromTwoStrings($this->moduleName, $this->policy);
     $rules = array(array($attributeName, 'type', 'type' => 'integer'), array($attributeName, 'length', 'max' => 3), array($attributeName, 'validateIsRequiredByComparingHelper', 'compareAttributeName' => $attributeName . FormModelUtil::DELIMITER . 'helper'));
     if (!empty($this->inherited)) {
         if ($this->isMinimumValueTheInheritedValue()) {
             $rules[] = array($attributeName, 'numerical', 'max' => $this->inherited);
         } else {
             $rules[] = array($attributeName, 'numerical', 'min' => $this->inherited);
         }
     }
     return $rules;
 }
 /**
  * @return - element array or null if the element should not be added to the metadata.
  */
 protected static function getElementInformation($moduleClassName, $policy, $policyInformation)
 {
     $rules = PolicyRulesFactory::createPolicyRulesByModuleClassNameAndPolicyInformation($moduleClassName, $policy, $policyInformation['explicit'], $policyInformation['inherited']);
     if (!$rules->showInView()) {
         return null;
     }
     if ($rules->isElementTypeDerived()) {
         $attributeName = 'null';
     } else {
         $attributeName = FormModelUtil::getDerivedAttributeNameFromTwoStrings($moduleClassName, $policy);
     }
     $element = array('attributeName' => $attributeName, 'type' => $rules->getElementAttributeType());
     return $element;
 }
 /**
  * The WRITE column in the user interface is a combination of
  * the WRITE, CHANGE_OWNER, and CHANGE_PERMISSIONS permissions.
  * WRITE controlls the other 2 permissions in the user interface.
  * @return array - resolved data
  */
 public static function resolveWritePermissionsFromArray($data)
 {
     assert('is_array($data)');
     foreach ($data as $moduleNamePermission => $value) {
         $nameParts = explode(FormModelUtil::DELIMITER, $moduleNamePermission);
         list($moduleClassName, $permission) = $nameParts;
         assert('is_numeric($permission)');
         if ($permission == Permission::WRITE) {
             $index = FormModelUtil::getDerivedAttributeNameFromTwoStrings($moduleClassName, Permission::CHANGE_OWNER);
             $data[$index] = $value;
             $index = FormModelUtil::getDerivedAttributeNameFromTwoStrings($moduleClassName, Permission::CHANGE_PERMISSIONS);
             $data[$index] = $value;
         }
     }
     return $data;
 }
 protected static function getElementInformation($moduleName, $right, $rightInformation)
 {
     $right = $right . FormModelUtil::DELIMITER . 'effective';
     $element = array('attributeName' => FormModelUtil::getDerivedAttributeNameFromTwoStrings($moduleName, $right), 'type' => 'RightEffective');
     return $element;
 }
 /**
  * Populate both the standard attribute in the data array
  * as well as the 'effective' and 'actual' attribute index which is expected
  * to be available in this data.
  * @return array;
  */
 public function attributeLabels()
 {
     $labels = array();
     foreach ($this->data as $moduleName => $items) {
         foreach ($items as $item => $information) {
             $attributeName = FormModelUtil::getDerivedAttributeNameFromTwoStrings($moduleName, $item);
             $labels[$attributeName] = $this->resolveLabelfromData($information);
             $labels[$attributeName . FormModelUtil::DELIMITER . 'effective'] = $labels[$attributeName];
             $labels[$attributeName . FormModelUtil::DELIMITER . 'actual'] = $labels[$attributeName];
         }
     }
     return $labels;
 }
 protected static function getExpiryAttributeName()
 {
     return FormModelUtil::getDerivedAttributeNameFromTwoStrings('UsersModule', 'POLICY_PASSWORD_EXPIRY_DAYS');
 }
 protected static function getElementInformation($moduleClassName, $permission, $permissionInformation)
 {
     $permission = $permission . FormModelUtil::DELIMITER . 'actual';
     $element = array('attributeName' => FormModelUtil::getDerivedAttributeNameFromTwoStrings($moduleClassName, $permission), 'type' => 'PermissionActual');
     return $element;
 }
 public function testGetDerivedAttributeNameFromTwoStrings()
 {
     $attributeName = FormModelUtil::getDerivedAttributeNameFromTwoStrings('x', 'y');
     $this->assertEquals('x__y', $attributeName);
 }
Example #11
0
 public function getFormRules()
 {
     $attributeName = FormModelUtil::getDerivedAttributeNameFromTwoStrings($this->moduleName, $this->policy);
     return array(array($attributeName, 'type', 'type' => 'integer'));
 }