/** * @internal param $user_id * @return array */ public static function getUserPerms() { self::construct(); $perms = array(); if (self::$emerAccess) { $emerPerms = self::getEmergencyAccessPerms(); } foreach (self::$AUP->load(array('user_id' => self::$user_id))->all() as $row) { $pK = strtolower($row['perm_key']); if ($pK == '') { continue; } if ($row['value'] == '1') { $hP = true; } else { if (self::$emerAccess && isset($emerPerms[$row['perm_key']]) && $emerPerms[$row['perm_key']]) { $hP = true; } else { $hP = false; } } $perms[$pK] = array('perm' => $pK, 'inheritted' => false, 'value' => $hP, 'Name' => self::getPermNameByPermKey($row['perm_key']), 'id' => $row['id']); } return $perms; }
/** * @param $roleKey * @param $permKey * @param $val * @return void */ private function saveRolePerm($roleKey, $permKey, $val) { $perm = $this->arp->load(array('role_key' => $roleKey, 'perm_key' => $permKey))->one(); if ($perm !== false) { $perm['value'] = $val; $this->arp->save((object) $perm); } else { $perm = new stdClass(); $perm->role_key = $roleKey; $perm->perm_key = $permKey; $perm->value = $val; $this->arp->save((object) $perm); } }
function getItemsOptions($item_id) { $this->setModels(); $foo = []; $options = $this->o->load(['field_id' => $item_id])->one(); $options = json_decode($options['options'], true); foreach ($options as $option => $value) { $foo[$option] = $value; if ($value == 'temp_f' || $value == 'temp_c' || $value == 'weight_lbs' || $value == 'weight_kg' || $value == 'height_cm' || $value == 'height_in' || $value == 'head_circumference_cm' || $value == 'head_circumference_in' || $value == 'waist_circumference_cm' || $value == 'waist_circumference_in') { $foo['enableKeyEvents'] = true; } } return $foo; }
/** * @param $role_id * @return mixed */ private static function getRoleNameByRoleId($role_id) { $row = self::$AR->load(['role_id' => $role_id])->one(); return $row['role_name']; }
/** * @param $params * @return array */ public function Read($params) { return $this->model->load($params)->all(); }