/**
  * Adapts all user's groups and adds the
  * everyone group into the list.
  * @return $data array
  */
 public function getViewData()
 {
     $data = array();
     $everyoneGroup = Group::getByName(Group::EVERYONE_GROUP_NAME);
     $data[$everyoneGroup->id] = array('displayName' => GroupsModule::resolveEveryoneDisplayLabel(), 'canRemoveFrom' => false);
     for ($i = 0; $i < $this->user->groups->count(); $i++) {
         $data[$this->user->groups[$i]->id] = array('displayName' => strval($this->user->groups[$i]), 'canRemoveFrom' => !$this->user->groups[$i]->isEveryone);
     }
     return $data;
 }
 public function actionAutoComplete($term, $autoCompleteOptions = null)
 {
     echo $this->renderAutoCompleteResults(GroupsModule::getPrimaryModelName(), $term, $autoCompleteOptions);
 }
 protected function makeTypeValuesAndLabels($isCreatingNewModel, $isRequired)
 {
     $data = array();
     if (!$isCreatingNewModel) {
         throw new NotSupportedException();
     }
     $data[self::TYPE_DYNAMIC_SAME_AS_TRIGGERED_MODEL] = Zurmo::t('WorkflowsModule', 'Same as triggered record');
     $data[self::TYPE_DYNAMIC_OWNER] = Zurmo::t('ZurmoModule', 'Owner');
     $groups = ExplicitReadWriteModelPermissionsElement::getSelectableGroupsData();
     foreach ($groups as $id => $name) {
         $data[$id] = Zurmo::t('ZurmoModule', 'Owner and users in {groupName}', array('{groupName}' => $name));
     }
     $data[self::TYPE_DYNAMIC_EVERYONE_GROUP] = GroupsModule::resolveEveryoneDisplayLabel();
     return $data;
 }
 protected static function getPermissionTypes()
 {
     return array(null => Zurmo::t('ZurmoModule', 'Owner'), ExplicitReadWriteModelPermissionsUtil::MIXED_TYPE_NONEVERYONE_GROUP => Zurmo::t('ZurmoModule', 'Owner and users in'), ExplicitReadWriteModelPermissionsUtil::MIXED_TYPE_EVERYONE_GROUP => GroupsModule::resolveEveryoneDisplayLabel());
 }
示例#5
0
 /**
  * Override to make sure the correct module label is used in the titlebar.
  * @see Controller::makeTitleBarAndEditAndDetailsView()
  */
 protected function makeTitleBarAndEditAndDetailsView($model, $renderType, $titleBarAndEditViewClassName = 'TitleBarAndEditAndDetailsView')
 {
     assert('$model != null');
     assert('$renderType == "Edit"');
     assert('$titleBarAndEditViewClassName != null && is_string($titleBarAndEditViewClassName)');
     return new $titleBarAndEditViewClassName($this->getId(), $this->getModule()->getId(), $model, GroupsModule::getPluralCamelCasedName(), $renderType);
 }
 protected static function getPermissionTypes()
 {
     return array(UserConfigurationForm::DEFAULT_PERMISSIONS_SETTING_OWNER => Zurmo::t('ZurmoModule', 'Owner'), UserConfigurationForm::DEFAULT_PERMISSIONS_SETTING_OWNER_AND_USERS_IN_GROUP => Zurmo::t('ZurmoModule', 'Owner and users in'), UserConfigurationForm::DEFAULT_PERMISSIONS_SETTING_EVERYONE => GroupsModule::resolveEveryoneDisplayLabel());
 }
 public static function getAllDefaultPermissionTypes()
 {
     return array(static::DEFAULT_PERMISSIONS_SETTING_OWNER => Zurmo::t('ZurmoModule', 'Owner'), static::DEFAULT_PERMISSIONS_SETTING_OWNER_AND_USERS_IN_GROUP => Zurmo::t('ZurmoModule', 'Owner and users in'), static::DEFAULT_PERMISSIONS_SETTING_EVERYONE => GroupsModule::resolveEveryoneDisplayLabel());
 }
示例#8
0
 public function __toString()
 {
     assert('$this->name === null || is_string($this->name)');
     if ($this->name === null) {
         return Zurmo::t('Core', '(Unnamed)');
     }
     if ($this->name == self::EVERYONE_GROUP_NAME) {
         return GroupsModule::resolveEveryoneDisplayLabel();
     } elseif ($this->name == self::SUPER_ADMINISTRATORS_GROUP_NAME) {
         return Zurmo::t('ZurmoModule', 'Super Administrators');
     }
     return $this->name;
 }
示例#9
0
 public function resolveEveryoneDisplayLabel()
 {
     $this->assertEquals('Everyone', GroupsModule::resolveEveryoneDisplayLabel());
     GroupsModule::setEveryoneDisplayLabel('test');
     $this->assertEquals('test', GroupsModule::resolveEveryoneDisplayLabel());
 }