$smarty->assign('title', TTi18n::gettext($title = 'Edit Permission Group')); // See index.php /* * Get FORM variables */ extract(FormVariables::GetVariables(array('action', 'id', 'data', 'group_id', 'old_data', 'src_user_id'))); $pcf = new PermissionControlFactory(); $action = Misc::findSubmitButton(); switch ($action) { case 'submit': case 'apply_preset': //Debug::setVerbosity( 11 ); Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10); $pf = new PermissionFactory(); $pcf->StartTransaction(); $pcf->setId($data['id']); $pcf->setCompany($current_company->getId()); $pcf->setName($data['name']); $pcf->setDescription($data['description']); //Check to make sure the currently logged in user is NEVER in the unassigned //user list. This prevents an administrator from accidently un-assigning themselves //from a group and losing all permissions. if (in_array($current_user->getId(), (array) $src_user_id)) { //Check to see if current user is assigned to another permission group. $current_user_failed = FALSE; $pclf = new PermissionControlListFactory(); $pclf->getByCompanyIdAndUserId($current_company->getId(), $current_user->getId()); if ($pclf->getRecordCount() == 0) { $current_user_failed = TRUE; } else { foreach ($pclf as $pc_obj) {