/** * Returns instance ACL roles */ protected function getInstanceRoles() { $result = array('' => translate('LBL_UW_DO_NOT_MAP_ROLE')); $roles = MBHelper::getRoles(); foreach ($roles as $role) { $result[$role->id] = $role->name; } return $result; }
/** * Removes a field from the layouts that it is on * * @param string $fieldName The name of the field to remove */ public function removeFieldFromLayouts($fieldName) { require_once 'modules/ModuleBuilder/parsers/ParserFactory.php'; $GLOBALS['log']->info(get_class($this) . "->removeFieldFromLayouts({$fieldName})"); $sources = $this->getViewMetadataSources(); $sources[] = array('type' => MB_BASICSEARCH); $sources[] = array('type' => MB_ADVANCEDSEARCH); $sources[] = array('type' => MB_POPUPSEARCH); $sources = array_merge($sources, $this->getWirelessLayouts()); $sources = array_merge($sources, $this->getPortalLayoutSources()); $GLOBALS['log']->debug(print_r($sources, true)); require_once 'modules/ModuleBuilder/MB/MBHelper.php'; $roles = MBHelper::getRoles(); foreach ($sources as $name => $defs) { $this->removeFieldFromLayout($this->module, $defs['type'], null, $fieldName); foreach ($roles as $role) { $this->removeFieldFromLayout($this->module, $defs['type'], null, $fieldName, array('role' => $role->id)); } } //Remove the fields in subpanel $data = $this->getParentModulesOfSubpanel($this->module); foreach ($data as $parentModule) { $this->removeFieldFromLayout($parentModule, MB_LISTVIEW, $this->module, $fieldName); } }
/** * Returns list of roles with marker indicating whether role specific metadata exists * * @param MetaDataImplementationInterface $implementation * @return array */ protected function getAvailableRoleList(MetaDataImplementationInterface $implementation) { return MBHelper::getAvailableRoleList($this->getHasMetaCallback($implementation)); }
/** * Returns list of roles with marker indicating whether role specific metadata for the given dropdown field exists * * @param string $name Dropdown field name * @return array */ protected function getAvailableRoleList($name) { $manager = MetaDataManager::getManager(); return MBHelper::getAvailableRoleList(function (array $params) use($manager, $name) { return $manager->hasEditableDropdownFilter($name, $params['role']); }); }