/** * * Loads all Roles for the Combobox in the filter. * Is only called when combo is opend first time * * @param sfWebRequest $request * @return <type> */ public function executeLoadAllRole(sfWebRequest $request) { $usermanagement = new Usermanagement(); $result = RoleTable::instance()->getAllRole(); $json_result = $usermanagement->buildRole($result,0); $this->renderText('({"result":'.json_encode($json_result).'})'); return sfView::NONE; }
public function preInsert($event) { $token = substr(md5(uniqid()), 0, 6); while (RoleTable::getInstance()->findOneBy('token', $token)) { $token = substr(md5(uniqid()), 0, 6); } $this->token = $token; }
public function load() { /** @var RoleFilter[] $roleFilters */ $roleFilters = RoleFilterTable::getInstance()->findBy('decision_id', $this->decision_id); $this->roles = RoleTable::getInstance()->findBy('decision_id', $this->decision_id); foreach ($roleFilters as $roleFilter) { $this->data[] = $roleFilter->role_id; } }
public function up() { $roles = RoleTable::getInstance()->createQuery('r')->groupBy('token')->having('COUNT(id) >= 2')->execute(); while ($roles->count()) { foreach ($roles as $role) { $token = substr(md5(uniqid()), 0, 6); while (RoleTable::getInstance()->findOneBy('token', $token)) { $token = substr(md5(uniqid()), 0, 6); } $role->token = $token; $role->save(); } $roles = RoleTable::getInstance()->createQuery('r')->groupBy('token')->having('COUNT(id) >= 2')->execute(); } }
public function executeList(sfWebRequest $request) { $account_id = $this->getUser()->getAttribute('account_id'); $this->roles = RoleTable::getInstance()->findByAccountId($account_id); }
public function executeMemberJson() { $this->asso = $this->getRoute()->getObject(); $this->membres = AssoMemberTable::getInstance()->getMembres($this->asso)->execute(); $this->roles = RoleTable::getInstance()->findAll(); }
public function getAlternativeMeasurementCreateResponse(sfGuardUser $user) { /** @var sfWebRequest $request */ $request = $this->getRequest(); $role = RoleTable::getInstance()->getOneForUser($user, $request->getParameter('role_id')); if (is_object($role)) { $plannedMeasurement = new PlannedAlternativeMeasurement(); $plannedMeasurement->Role = $role; $plannedMeasurement->criterion_id = $request->getParameter('criterion_id'); $plannedMeasurement->alternative_id = $request->getParameter('alternative_id'); try { $plannedMeasurement->save(); $result = array('status' => 'success', 'result' => $plannedMeasurement->getAPIData()); } catch (sfException $ex) { $result = array('status' => 'error', 'error' => $ex->getMessage()); } } else { $result = array('status' => 'error', 'error' => sprintf('Project with id %d does not exist', $request->getParameter('decision_id'))); } return $result; }
public function configure() { parent::configure(); unset($this['semestre_id'], $this['asso_id'], $this['user_id']); $this->widgetSchema['role_id'] = new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Role'), 'add_empty' => false, 'query' => RoleTable::getInstance()->getUnsecureRole())); }
public function workflow_edit($id) { parent::load('model', 'workflow'); parent::load('model', 'order'); parent::load('model', 'system/contrib/auth'); $workflow = WorkflowTable::getInstance()->find($id); $all_roles = RoleTable::getInstance()->findAll(); $workflow_roles = array_filter(explode(',', $workflow->roles)); $options = array(); foreach ($all_roles as $ar) { $options[$ar['id']] = $ar['name']; } if ($this->is_post()) { $workflow->roles = sprintf(',%s,', implode(',', $_POST['roles'])); $workflow->save(); HTTPRedirect::flash_to('manager/workflow_permission', '编辑工作流程权限成功', $this->smarty); } $this->smarty->assign('roles', $workflow_roles); $this->smarty->assign('workflow', $workflow); $this->smarty->assign('all_roles', $options); $this->smarty->display('manager/order/workflow_edit'); }
/** * Load auth for editing template * * @param sfWebRequest $request * @return <type> */ public function executeLoadDefaultAuthorization(sfWebRequest $request) { $sysObj = new SystemSetting(); $auth = new MergeAuthorization(); $authorization = AuthorizationConfigurationTable::instance()->getAuthorizationConfiguration(false)->toArray(); $defaultRole = AuthorizationConfigurationTable::instance()->getAllRoles()->toArray(); $worklfosettings = $sysObj->buildAuthorizationColumns($authorization, $this->getContext()); $allRoles = RoleTable::instance()->getAllRole()->toArray(); $mergedRoles = $auth->mergeRoles($allRoles, $defaultRole, $worklfosettings); $this->renderText('{"result":'.json_encode($mergedRoles).'}'); return sfView::NONE; }
public function executeEditUserProjectRole(sfWebRequest $request) { $this->forward404Unless($this->user = Doctrine::getTable('User')->find(array($request->getParameter('uid'))), sprintf('Object user does not exist (%s).', $request->getParameter('uid'))); $this->forward404Unless($this->project = Doctrine::getTable('Project')->find(array($request->getParameter('id'))), sprintf('Object project does not exist (%s).', $request->getParameter('id'))); $account_id = $this->getUser()->getAttribute('account_id'); if ($this->project->account_id != $account_id || $this->user->account_id != $account_id) { $this->redirect('default/secure'); } $this->roles = RoleTable::getInstance()->findByAccountId($account_id); }
/** * * Check if the user has sending rights * * @param int $mailinglistVersionId * @return boolean */ public function checkSendingRight($mailinglistVersionId) { $credentialId = CredentialTable::instance()->getCredentialIdByRight('workflow','workflowmanagement','sendWorkflow')->toArray(); $rightCheck = RoleTable::instance()->getRoleByRightAndRoleName($credentialId[0]['id'], $this->userroleName)->toArray(); if(empty($rightCheck) == true) { $result['allowedtosend'] = 0; return $result; } else { $sender = MailinglistAuthorizationSettingTable::instance()->getSettingsByType('senderwithrights', $mailinglistVersionId)->toArray(); $sender[0]['allowedtosend'] = 1; return $sender[0]; } }
/** * Function checks, when user is trying to create a new userrole , if its * name is already stored in database. * When already stored, no save process is done. * * * @param sfWebRequest $request * @return <type> */ public function executeCheckForExistingRole(sfWebRequest $request) { $result = RoleTable::instance()->getRoleByDescription($request->getParameter('description')); if($result[0]->getDescription() == $request->getParameter('description')) { $this->renderText('0'); // no write access } else { $this->renderText('1'); // write access } return sfView::NONE; }