public function set() { foreach ($this->_filters as $filter) { $filter->apply(); } $result = $this->_CI->Do_usergroup->get(); $this->_totalResults = count($result); //var_dump(count($result));die(); if ($result) { foreach ($result as $row) { $usergroup = new Usergroup(); $usergroup->setByData($row); $this->_usergroups[] = $usergroup; } } //var_dump(count($this->_usergroups));die(); if ((!empty($this->_startItem) || $this->_startItem == 0) && !empty($this->_offsetCount)) { for ($i = $this->_startItem; $i <= $this->_startItem + ($this->_offsetCount - 1); $i++) { if (isset($this->_usergroups[$i])) { $this->_items[] = $this->_usergroups[$i]; } else { break; } } } else { $this->_items = $this->_usergroups; } }
public function Execute(Template $template, Session $session, $request) { if ($session['user'] instanceof Member && $session['user']['perms'] & ADMIN) { $ug = new Usergroup(); $dba = DBA::Open(); if (!$request['name']) { return new Error(sprintf($template['L_REQUIREDFIELDS'], $template['L_NAME']), $template); } if (!$request['description']) { return new Error(sprintf($template['L_REQUIREDFIELDS'], $template['L_DESCRIPTION']), $template); } if (!$request['mod_name']) { return new Error(sprintf($template['L_REQUIREDFIELDS'], $template['L_MODERATOR']), $template); } $name = $dba->Quote($request['name']); $description = $dba->Quote($request['description']); $mod_name = $dba->Quote($request['mod_name']); $mod_id = $dba->GetValue("SELECT id FROM " . USERS . " WHERE name = '{$mod_name}'"); $permissions = intval($request['perms']); $type = intval($request['type']); if ($ug->AddUsergroup($name, $description, $mod_name, $mod_id, $permissions, $type)) { header("Location: admin.php?act=groups"); } } return TRUE; }
/** * [emailToUser Send Email to user for report user status] * @param [type] $email [user email] * @param [type] $name [user name] * @param [type] $status [user status] * @return [type] [description] */ public function emailToUser($email, $name, $status, $group, $role) { if ($status == 'yes') { $status = 'เปิดใช้งาน'; } else { $status = 'ปิดการใช้งาน'; } $role_obj = new Roles(); $_role = $role_obj->getRoleName($role); $grp_obj = new Usergroup(); $_grp = $grp_obj->getGrpName($group); //var_dump($_grp);exit; Mail::send('userlist.email', array("name" => $name, "status" => $status, "group" => $_grp->grp_nameth, "role" => $_role->role_name), function ($message) use($email) { $message->to($email, 'Admin@NHC')->subject('Your status @NHC'); }); }
public function FetchUsergroups() { $group_list = $this->usergroup_id; if (strlen($this->other_usergroup_ids)) { $group_list .= ',' . $this->other_usergroup_ids; } return Usergroup::FetchGroup('usergroup_id IN (' . $group_list . ')'); }
public function WillFire() { $user = Bugdar::$auth->current_user(); if ($user && !$user->CheckGroupPermission(Usergroup::CAN_VIEW) || !$user && !Usergroup::AnonymousGroup()->mask & Usergroup::CAN_VIEW) { EventPump::Pump()->RaiseEvent(new StandardErrorEvent('NO_PERMISSION_CAN_VIEW')); return; } }
/** * Retrieves a list of models based on the current search/filter conditions. * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions. */ public function search() { // Warning: Please modify the following code to remove attributes that // should not be searched. $ugRows = Usergroup::model()->findAll('uid=:uid', array(':uid' => Yii::app()->user->getState("user_id"))); $grps = []; foreach ($ugRows as $ug) { $grps[] = $ug['gid']; } /*Get Blocked Item Ids*/ $getRows = Blockeditem::model()->findAllByAttributes(array('blocked_for' => Yii::app()->user->getState("user_id"), 'flag' => 'U', 'unblock_by' => NULL)); $biU = []; foreach ($getRows as $row) { $biU[] = $row['item_id']; } $getRows = Blockeditem::model()->findAllByAttributes(array('blocked_for' => $grps, 'flag' => 'G', 'unblock_by' => NULL)); $biG = []; foreach ($getRows as $row) { $biG[] = $row['item_id']; } ////////////Blocked For All $getRows = Blockeditem::model()->findAllByAttributes(array('flag' => 'A', 'unblock_by' => NULL)); $biA = []; foreach ($getRows as $row) { $biA[] = $row['item_id']; } $blockeditemtableIds = array_merge($biU, $biG); $blockeditemtableIds = array_unique(array_merge($blockeditemtableIds, $biA)); $criteria = new CDbCriteria(); $criteria->compare('category_id', $this->category_id, true); $criteria->compare('name', $this->name, true); $criteria->compare('location_id', $this->location_id); $criteria->compare('technical_incharge_id', $this->technical_incharge_id); $criteria->compare('status_id', $this->status_id); $criteria->compare('manufacturer_id', $this->manufacturer_id); $criteria->compare('cartridge_type_id', $this->cartridge_type_id); $criteria->compare('management_type_id', $this->management_type_id); $criteria->compare('threshold', $this->threshold); $criteria->compare('link_to', $this->link_to); $criteria->compare('image', $this->image, true); $criteria->compare('imageFileName', $this->imageFileName, true); $criteria->compare('imageFileType', $this->imageFileType, true); $criteria->compare('document', $this->document, true); $criteria->compare('documentFileName', $this->documentFileName, true); $criteria->compare('documentFileType', $this->documentFileType, true); $criteria->compare('is_deleted', $this->is_deleted); $criteria->addCondition("is_deleted = 0"); $criteria->addNotInCondition('id', $blockeditemtableIds); if (isset($_GET['printerId'])) { $printerId = $_GET['printerId']; $criteria->addCondition("link_to = {$printerId}"); } if (isset($_GET['category_id'])) { $a = $_GET['category_id']; $criteria->addCondition("category_id = '{$a}'"); } return new CActiveDataProvider($this, array('criteria' => $criteria, 'pagination' => array('pageSize' => Yii::app()->user->getState('pageSize', 3)))); }
public function run() { $adminUser = Config::get('ravel::app.setup_user'); $adminGroup = Usergroup::orderBy('id', 'asc')->first(); $adminUser['usergroup_id'] = (int) $adminGroup->id; DB::table('users')->delete(); $user = new Usermodel(); $user->fill($adminUser); $user->activated = true; $user->api_token = makeApiKey(); $user->save(); }
public function edit() { //var_dump($usrgrpId);die(); if (!$this->securitypolicy->validateAccessRight(3, 'write')) { $this->load->view('access_denied'); } $this->load->library('form_validation'); $usergroup = new Usergroup($this->input->post('usergroup-id')); $this->_viewData['usrgrpDetl'] = $usergroup->getDetails(); if ($this->form_validation->run() == false) { $this->_backToForm(); } else { $usergroup->updateName($this->input->post('usergroup-name')); if (empty($usergroup->errors)) { $this->session->set_userdata(array('status' => 'success')); redirect(site_url('Admin/usergroup_manager'), 'refresh'); } else { $this->_viewData['errors'] = $usergroup->errors; $this->_backToForm(); } } }
public static function UpdateStatusOfConsumables($userId) { /*Get the user's group*/ $ugRows = Usergroup::model()->findAll('uid=:uid', array(':uid' => $userId)); $grps = []; foreach ($ugRows as $ug) { $grps[] = $ug['gid']; } /*Get Blocked Item Table Ids*/ $getRows = BlockeditemUser::model()->findAllByAttributes(array('uid' => $userId)); $biU = []; foreach ($getRows as $row) { $biU[] = $row['blockitem_id']; } $getRows = BlockeditemGroup::model()->findAllByAttributes(array('gid' => $grps)); $biG = []; foreach ($getRows as $row) { $biG[] = $row['blockitem_id']; } ////////////Blocked For All $getRows = Blockeditem::model()->findAllByAttributes(array('flag' => 0)); $biA = []; foreach ($getRows as $row) { $biA[] = $row['id']; } $blockeditemtableIds = array_merge($biU, $biG); $blockeditemtableIds = array_unique(array_merge($blockeditemtableIds, $biA)); $consumableItemIds = Blockeditem::model()->findAllByAttributes(array('id' => $blockeditemtableIds)); $consIds = []; foreach ($consumableItemIds as $row) { $consIds[] = $row['item_id']; } $getConsumables = Consumable::model()->findAll(); foreach ($getConsumables as $cons) { $model = Consumable::model()->findByPk($cons['id']); if (in_array($cons['id'], $consIds)) { $model->isBlockedForMe = 1; } else { $model->isBlockedForMe = 0; } $model->update(); } }
/** * [getGrpName group name] * @param [type] $id [user id] * @return [array] [description] */ public function getGrpName($id) { $grp = Usergroup::where('id', '=', $id)->first(); return $grp; }
<?php echo $form->errorSummary($model); ?> <?php $groupName = $_GET['groupName']; ?> <h1> Manage Group <span style="color:#B40431"><?php echo "{$groupName}"; ?> </h1> <?php echo "<br/>"; ?> <?php $this->widget('ext.multiselects.XMultiSelects', array('id' => 'listbuilder', 'leftTitle' => 'Group Users', 'leftName' => 'Usergroup[groupusers][]', 'leftList' => Usergroup::model()->findUsersByGroup($_GET['groupId']), 'rightTitle' => 'Other Users', 'rightName' => 'Usergroup[otherusers][]', 'rightList' => Usergroup::model()->findUsersNotInGroup($_GET['groupId']), 'size' => 20, 'width' => '200px')); ?> <div style="text-align: center;"> <?php echo CHtml::submitButton('Update', array('submit' => array('usergroup/moveusers', 'groupId' => $_GET['groupId'])), array('color' => TbHtml::BUTTON_COLOR_SUCCESS, 'size' => TbHtml::BUTTON_SIZE_DEFAULT)); ?> </div <?php $this->endWidget(); ?> </div><!-- form -->
public function setDefaultUsergroup(Usergroup $usergroup) { $this->getObject()->setUsergroup(null); $this->setDefault('UserGroup_id', $usergroup->getId()); }
/* @var $model Usergroup */ /* @var $form TbActiveForm */ ?> <div class="form"> <?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'usergroup-form', 'enableAjaxValidation' => false)); ?> <p class="help-block">Fields with <span class="required">*</span> are required.</p> <?php echo $form->errorSummary($model); ?> <?php $this->widget('ext.multiselects.XMultiSelects', array('leftTitle' => 'Group Users', 'leftName' => 'Usergroup[][1]', 'leftList' => Usergroup::model()->findUsersByGroup(1), 'rightTitle' => 'Other Users', 'rightName' => 'Usergroup[][1]', 'rightList' => Usergroup::model()->findUsersNotInGroup(1), 'size' => 20, 'width' => '200px')); ?> <div class="form-actions"> <?php echo TbHtml::submitButton($model->isNewRecord ? 'Create' : 'Save', array('color' => TbHtml::BUTTON_COLOR_PRIMARY, 'size' => TbHtml::BUTTON_SIZE_LARGE)); ?> </div> <?php $this->endWidget(); ?> </div><!-- form -->
public function usergroup_remove($usrgrpId) { if (!$this->securitypolicy->validateAccessRight(3, 'delete')) { $this->_redirectInvalidAccess(); } $usergroup = new Usergroup($usrgrpId); $this->_viewData['usrgrpDetl'] = $usergroup->getDetails(); $this->_viewData['showmsg'] = true; $this->load->view('usergroup_add', $this->_viewData); }
require_once DOL_DOCUMENT_ROOT . '/core/class/ldap.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/ldap.lib.php'; $langs->load("companies"); $langs->load("ldap"); $langs->load("users"); $canreadperms = true; if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $canreadperms = $user->admin || $user->rights->user->group_advance->read; } $id = GETPOST('id', 'int'); $action = GETPOST('action', 'alpha'); $socid = 0; if ($user->societe_id > 0) { $socid = $user->societe_id; } $fgroup = new Usergroup($db); $fgroup->fetch($id); $fgroup->getrights(); /* * Actions */ if ($action == 'dolibarr2ldap') { $message = ""; $db->begin(); $ldap = new Ldap(); $result = $ldap->connect_bind(); $info = $fgroup->_load_ldap_info(); // Get a gid number for objectclass PosixGroup if (in_array('posixGroup', $info['objectclass'])) { $info['gidNumber'] = $ldap->getNextGroupGid(); }
/** * Init */ $language_file = array('userInfo', 'admin'); $cidReset = true; require_once '../inc/global.inc.php'; api_block_anonymous_users(); $this_section = SECTION_COURSES; $interbreadcrumb[] = array('url' => 'classes.php', 'name' => get_lang('Classes')); if (isset($_GET['id'])) { $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Groups')); } if (api_get_setting('show_groups_to_users') == 'false') { } Display::display_header($tool_name, 'Classes'); $usergroup = new Usergroup(); $usergroup_list = $usergroup->get_usergroup_by_user(api_get_user_id()); if (!empty($usergroup_list)) { echo Display::tag('h1', get_lang('MyClasses')); foreach ($usergroup_list as $group_id) { if (isset($_GET['id']) && $_GET['id'] != $group_id) { continue; } $data = $usergroup->get($group_id); echo Display::tag('h2', $data['name']); echo Display::div($data['description']); } } else { if (api_is_platform_admin()) { Display::display_normal_message(Display::url(get_lang('AddClasses'), api_get_path(WEB_CODE_PATH) . 'admin/usergroups.php?action=add'), false); }
/** * Declares an association between this object and a Usergroup object. * * @param Usergroup $v * @return UsergroupHasActivity The current object (for fluent API support) * @throws PropelException */ public function setUsergroup(Usergroup $v = null) { if ($v === null) { $this->setUsergroupId(NULL); } else { $this->setUsergroupId($v->getId()); } $this->aUsergroup = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the Usergroup object, it will not be re-added. if ($v !== null) { $v->addUsergroupHasActivity($this); } return $this; }
</span> <?php echo CHtml::link('<i class="icon-pencil"></i>', array('update', 'id' => $model->id), array('class' => 'btn-warning btn buttonDesign', 'title' => 'Update')); echo CHtml::link('<i class="icon-trash"></i>', '#', array('class' => 'btn-warning btn buttonDesign', 'title' => 'Delete', 'submit' => array('delete', 'id' => $model->id), 'confirm' => 'Are you sure you want to delete this item?')); ?> </h1> <table> <tr><td> <?php $this->widget('ext.DetailView4Col', array('htmlOptions' => array('class' => 'table table-striped table-condensed table-hover'), 'data' => $model, 'attributes' => array('name', 'password', 'organisation_id', 'pw_md5', 'email', 'phone', 'phones', 'mobile', 'fn', 'ln', 'active', 'id_auth', 'auth_method', 'last_login', 'date_mod', 'designation'))); ?> </td> <td> <?php $grps = Usergroup::model()->findAllByAttributes(array('uid' => $model->id)); $depts = Userdept::model()->findAllByAttributes(array('uid' => $model->id)); echo "<table class='table table-bordered'>"; if (count($depts) == 0) { echo "<tr style='background:#F7819F;color:white'><td>{$model->name} doesn't belong to any department</td></tr>"; } else { echo "<tr style='background:#F5A9A9;'><th colspan='2'>Departments</th></tr>"; foreach ($depts as $d) { $department = Dept::model()->findByAttributes(array('id' => $d['dept_id'])); $deptName = $department['name']; echo "<tr><td colspan='2'>{$deptName}</td></tr>"; } } if (count($grps) == 0) { echo "<tr style='background:#F7819F;color:white'><td>{$model->name} doesn't belong to any group</td></tr>"; } else {
if ($action == 'add' && $caneditperms) { $editgroup = new Usergroup($db); try { $editgroup->load($id); $editgroup->values->rights->$_GET['pid'] = true; $editgroup->record(); } catch (Exception $e) { $mesg = $e->getMessage(); } Header("Location: " . $_SERVER['PHP_SELF'] . "?id=".$id."&mesg=" . urlencode($mesg)); exit; } if ($action == 'remove' && $caneditperms) { $editgroup = new Usergroup($db); try { $editgroup->load($id); unset($editgroup->values->rights->$_GET['pid']); $editgroup->record(); } catch (Exception $e) { $mesg = $e->getMessage(); } Header("Location: " . $_SERVER['PHP_SELF'] . "?id=".$id."&mesg=" . urlencode($mesg)); exit; } /** * View
$caneditperms = $user->admin || $user->rights->user->group_advance->write; $candisableperms = $user->admin || $user->rights->user->group_advance->delete; } $langs->load("users"); $langs->load("other"); $id = GETPOST('id', 'int'); $action = GETPOST('action', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); $userid = GETPOST('user', 'int'); $message = ''; // Security check $result = restrictedArea($user, 'user', $id, 'usergroup&usergroup', 'user'); if (!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->multicompany->transverse_mode) { accessforbidden(); } $object = new Usergroup($db); /** * Action remove group */ if ($action == 'confirm_delete' && $confirm == "yes") { if ($caneditperms) { $object->fetch($id); $object->delete(); header("Location: index.php"); exit; } else { $langs->load("errors"); $message = '<div class="error">' . $langs->trans('ErrorForbidden') . '</div>'; } } /**
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param Usergroup $value A Usergroup object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(Usergroup $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } // if key === null self::$instances[$key] = $obj; } }
?> </option> </select> </li> <!-- added by Gaurang 2014-04-14 --> <li> <?php $Project_Manager = getGlobalSetting('Project_Manager'); ?> <label for='Project_Manager'><?php $clang->eT("Select Project Manager User Group"); ?> </label> <?php //$project_manager = Contact_title::model()->findAll(); $project_manager = Usergroup::model()->findAll(); $project_manager_list = CHtml::listData($project_manager, 'ugid', 'name'); echo CHtml::dropDownList('Project_Manager', $Project_Manager, $project_manager_list, array('prompt' => 'Select Project Manager User Group')); ?> </li> <li> <?php $Own_Panel = getGlobalSetting('Own_Panel'); ?> <label for='Own_Panel'><?php $clang->eT("Select Internal Company"); ?> </label> <?php //$own_panel = getCompanyDetail(); $sql = "SELECT * FROM {{view_company}} WHERE company_type LIKE '%V%'";
$canreadperms = $user->admin || $user->rights->user->group_advance->read; $caneditperms = $user->admin || $user->rights->user->group_advance->write; $candisableperms = $user->admin || $user->rights->user->group_advance->delete; } $langs->load("users"); $langs->load("other"); $id = GETPOST('id', 'int'); $action = GETPOST('action', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); $userid = GETPOST('user', 'int'); // Security check $result = restrictedArea($user, 'user', $id, 'usergroup&usergroup', 'user'); if (!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->multicompany->transverse_mode) { accessforbidden(); } $object = new Usergroup($db); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); /** * Action remove group */ if ($action == 'confirm_delete' && $confirm == "yes") { if ($caneditperms) { $object->fetch($id); $object->delete(); header("Location: index.php"); exit; } else { $langs->load("errors"); setEventMessages($langs->trans('ErrorForbidden'), null, 'errors');
$canreadperms=($user->admin || $user->rights->user->group_advance->read); $caneditperms=($user->admin || $user->rights->user->group_advance->write); $candisableperms=($user->admin || $user->rights->user->group_advance->delete); } $langs->load("users"); $langs->load("other"); // Security check $result = restrictedArea($user, 'user', $_GET["id"], 'usergroup', 'user'); $action=GETPOST("action"); $confirm=GETPOST("confirm"); $userid=GETPOST("user","int"); $object = new Usergroup($db); /** * Action remove group */ if ($action == 'confirm_delete' && $confirm == "yes") { if ($caneditperms) { $object->fetch($_GET["id"]); $object->delete(); Header("Location: index.php"); exit; } else
/** * Returns an HTML block with classes (if show_groups_to_users is true) * @return string A list of links to users classes tools, or an empty string if show_groups_to_users is disabled * @assert () == '' */ public function return_classes_block() { $html = ''; if (api_get_setting('show_groups_to_users') == 'true') { $usergroup = new Usergroup(); $usergroup_list = $usergroup->get_usergroup_by_user(api_get_user_id()); $classes = ''; if (!empty($usergroup_list)) { foreach ($usergroup_list as $group_id) { $data = $usergroup->get($group_id); $data['name'] = Display::url($data['name'], api_get_path(WEB_CODE_PATH) . 'user/classes.php?id=' . $data['id']); $classes .= Display::tag('li', $data['name']); } } if (api_is_platform_admin()) { $classes .= Display::tag('li', Display::url(get_lang('AddClasses'), api_get_path(WEB_CODE_PATH) . 'admin/usergroups.php?action=add')); } if (!empty($classes)) { $classes = Display::tag('ul', $classes, array('class' => 'nav nav-list')); $html .= $this->show_right_block(get_lang('Classes'), $classes, 'classes_block'); } } return $html; }
// checking the current installation if ($current_access_url_id == -1) { Display::display_warning_message(get_lang('URLNotConfiguredPleaseChangedTo') . ': ' . api_get_path(WEB_PATH)); } elseif (api_is_platform_admin()) { $quant = UrlManager::relation_url_user_exist(api_get_user_id(), $current_access_url_id); if ($quant == 0) { Display::display_warning_message('<a href="' . api_get_self() . '?action=register&sec_token=' . $parameters['sec_token'] . '">' . get_lang('ClickToRegisterAdmin') . '</a>', false); } } // action menu echo '<div class="actions">'; echo Display::url(Display::return_icon('new_link.png', get_lang('AddUrl'), array(), ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH) . 'admin/access_url_edit.php'); echo Display::url(Display::return_icon('user.png', get_lang('ManageUsers'), array(), ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH) . 'admin/access_url_edit_users_to_url.php'); echo Display::url(Display::return_icon('course.png', get_lang('ManageCourses'), array(), ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH) . 'admin/access_url_edit_courses_to_url.php'); //echo Display::url(Display::return_icon('session.png', get_lang('ManageSessions'), array(), ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH).'admin/access_url_edit_sessions_to_url.php'); $userGroup = new Usergroup(); if ($userGroup->getUseMultipleUrl()) { echo Display::url(Display::return_icon('class.png', get_lang('ManageUserGroup'), array(), ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH) . 'admin/access_url_edit_usergroup_to_url.php'); } if (isMultipleUrlSupport()) { echo Display::url(Display::return_icon('folder.png', get_lang('ManageCourseCategories'), array(), ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH) . 'admin/access_url_edit_course_category_to_url.php'); } echo '</div>'; //$table = new SortableTable('urls', 'url_count_mask', 'get_url_data_mask',2); $sortable_data = UrlManager::get_url_data(); $urls = array(); foreach ($sortable_data as $row) { //title $url = Display::url($row['url'], $row['url'], array('target' => '_blank')); $description = $row['description']; //Status
} if (!$canreadperms) { accessforbidden(); } /** * Actions */ if ($action == 'addrights' && $caneditperms) { $editgroup = new Usergroup($db); $result = $editgroup->fetch($id); if ($result > 0) { $editgroup->addrights($rights, $module); } } if ($action == 'delrights' && $caneditperms) { $editgroup = new Usergroup($db); $result = $editgroup->fetch($id); if ($result > 0) { $editgroup->delrights($rights, $module); } } /** * View */ $form = new Form($db); llxHeader('', $langs->trans("Permissions")); if ($id) { $fgroup = new Usergroup($db); $fgroup->fetch($id); $fgroup->getrights(); /*
public function Fire() { $this->usergroups = Usergroup::FetchGroup(); }
public function search2() { // Warning: Please modify the following code to remove attributes that // should not be searched. $ugRows = Usergroup::model()->findAll('uid=:uid', array(':uid' => Yii::app()->user->getState("user_id"))); $grps = []; foreach ($ugRows as $ug) { $grps[] = $ug['gid']; } /*Get Blocked Item Ids*/ $getRows = Blockeditem::model()->findAllByAttributes(array('blocked_for' => Yii::app()->user->getState("user_id"), 'flag' => 'U', 'unblock_by' => NULL)); $biU = []; foreach ($getRows as $row) { $biU[] = $row['item_id']; } $getRows = Blockeditem::model()->findAllByAttributes(array('blocked_for' => $grps, 'flag' => 'G', 'unblock_by' => NULL)); $biG = []; foreach ($getRows as $row) { $biG[] = $row['item_id']; } ////////////Blocked For All $getRows = Blockeditem::model()->findAllByAttributes(array('flag' => 'A', 'unblock_by' => NULL)); $biA = []; foreach ($getRows as $row) { $biA[] = $row['item_id']; } $blockeditemtableIds = array_merge($biU, $biG); $blockeditemtableIds = array_unique(array_merge($blockeditemtableIds, $biA)); $criteria = new CDbCriteria(); $criteria->compare('id', $this->id); $criteria->compare('commodity_id', $this->commodity_id); $criteria->compare('category_id', $this->category_id, true); $criteria->compare('link_to', $this->link_to); $criteria->compare('name', $this->name, true); $criteria->compare('location_id', $this->location_id); $criteria->compare('technical_incharge_id', $this->technical_incharge_id); $criteria->compare('size', $this->size); $criteria->compare('status_id', $this->status_id); $criteria->compare('monitor_type_id', $this->monitor_type_id); $criteria->compare('manufacturer_id', $this->manufacturer_id); $criteria->compare('serial_number', $this->serial_number); $criteria->compare('management_type_id', $this->management_type_id); $criteria->compare('comments', $this->comments, true); $criteria->compare('document', $this->document, true); $criteria->compare('documentFileName', $this->documentFileName, true); $criteria->compare('documentFileType', $this->documentFileType, true); $criteria->compare('image', $this->image, true); $criteria->compare('imageFileName', $this->imageFileName, true); $criteria->compare('imageFileType', $this->imageFileType, true); $criteria->compare('enable_financial', $this->enable_financial, true); $criteria->compare('available_on_loan', $this->available_on_loan, true); $criteria->compare('has_microphone', $this->has_microphone, true); $criteria->compare('has_speaker', $this->has_speaker, true); $criteria->compare('has_subD', $this->has_subD, true); $criteria->compare('has_BNC', $this->has_BNC, true); $criteria->compare('has_DVI', $this->has_DVI, true); $criteria->compare('has_pivot', $this->has_pivot, true); $criteria->compare('has_HDMI', $this->has_HDMI, true); $criteria->compare('has_displayport', $this->has_displayport, true); $criteria->compare('is_deleted', $this->is_deleted); $criteria->addCondition("is_deleted = 0"); $criteria->addNotInCondition('id', $blockeditemtableIds); if (isset($_GET['category_id'])) { $a = $_GET['category_id']; $criteria->addCondition("category_id = '{$a}'"); } return new CActiveDataProvider($this, array('criteria' => $criteria, 'pagination' => false)); }
/** * Add user groups to the groups table, randomly assign them existing tokens. * @param integer $num number of groups to add, or configured value if null. */ private function populate_groups_add($num = null) { if (!isset($num)) { $num = Options::get('populate__groups'); } // Get all tokens that we have created. $tokens = $this->populate_tokens_get(); // Add all these groups. $count = 0; while ($count++ < $num) { // Create a new group. $group = Usergroup::create(array('name' => 'populate_' . $this->helper_random_name())); // assign tokens to this new group. $max_tokens = count($tokens) - 1; $num_tokens = rand(0, $max_tokens); while ($num_tokens-- > 0) { $token = rand(0, $max_tokens); ACL::grant_group($group->id, $tokens[$token]->id); } } return; }