include_once dirname(__FILE__) . '/../classes/user.php'; include_once dirname(__FILE__) . '/../classes/service.php'; //session_start(); $tenantID = $_SESSION['tenantID']; $userID = $_SESSION['userID']; if ($_SERVER['REQUEST_METHOD'] == "GET") { $id = Utility::getRequestVariable('id', 0); $detail = Utility::getRequestVariable('detail', 'no'); if ($id == 0) { header(' ', true, 400); echo "No user ID specified."; die; } try { $requestedUser = new User($id, $tenantID); $entity = $requestedUser->getEntity($id, $tenantID, $userID); if ($detail == 'yes' || ($detail = 'true')) { // add tenants and other stuff for full detail requests $entity["tenants"] = $requestedUser->getTenants(); } $set = json_encode($entity); } catch (Exception $e) { Service::returnError("Unable to retrieve user: "******"User"); die; } header('Content-Type: application/json'); header('Access-Control-Allow-Origin: *'); echo $set; } elseif ($_SERVER['REQUEST_METHOD'] == "POST") { $json = file_get_contents('php://input'); $data = json_decode($json);
public static function actionModifyPassword() { if (ControleurRights::canAddUser()) { if (isset($_POST['data']['password']) && isset($_POST['data']['id']) && strlen($_POST['data']['password']) > 7) { $id = $_POST['data']['id']; $password = $_POST['data']['password']; $user = User::getEntity($id); $user->setPassword(sha1($password . $user->getSalt())); $user->updateEntity(); } } }
public static function actionGetEntity() { if (isset($_GET['t']) && $_GET['t']) { $table = $_GET['t']; if (isset($_GET['i']) && $_GET['i'] && $_GET['i'] != null) { $id = $_GET['i']; } else { $id = null; } if ($table == 'customers' && ControleurRights::canAddCustomer()) { return Customer::getEntity($id); } elseif ($table == 'team_member' && ControleurRights::canAddTeamMember()) { $member = TeamMember::getEntity($id); $member->setSkills(Skill::getSkillsForUser($id)); return $member; } elseif ($table == 'users' && ControleurRights::canAddUser()) { $user = User::getEntity($id); $user->setPicture(); return $user; } elseif ($table == 'projects' && ControleurRights::canDisplayProjects()) { $project = Project::getEntity($id); $project->setSkills(Skill::getSkillsForProject($id)); return $project; } elseif ($table == 'plans' && ControleurRights::canDisplayPlans()) { return Plan::getEntity($id); } elseif ($table == 'right' && ControleurRights::canAddUser()) { $right = Right::getEntity($id); $rightClass = new ReflectionClass('RightColumnsLabel'); $right->setLabels($rightClass->getConstants()); return $right; } elseif ($table == 'skills' && ControleurRights::canAddSkills()) { return Skill::getEntity($id); } else { return "Table " . $table . " non configurée dans le CRUD ou interdiction d'accès à l'utilisateur"; } } }
<?php include_once dirname(__FILE__) . '/core/partials/pageCheck.php'; include_once dirname(__FILE__) . '/core/classes/user.php'; include_once dirname(__FILE__) . '/classes/feature.php'; $thisPage = "author"; $id = Utility::getRequestVariable('id', 0); $errorMsg = ""; if ($id == 0) { $errorMsg = "You must specify a valid author id."; } else { try { $class = new User($id, $tenantID); $author = $class->getEntity($id); Log::logPageView('author', $id, ''); $feature = new Feature($userID, $tenantID); $filters = array("author" => $author["id"], "status" => "Published"); $features = $feature->getEntities($filters, 9, 0); } catch (Exception $ex) { $errorMsg = "Unable to load requested author: " . $ex->getMessage(); } } ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title><?php echo Utility::getTenantProperty($applicationID, $_SESSION['tenantID'], $userID, 'title'); ?>
/** * @param string $updated_by * Updated_by * @return TrackedEntity */ public function setUpdated_by($updated_by) { if ($updated_by != null && $updated_by != '') { $user = User::getEntity($updated_by); $this->updated_by_name = $user->getFirst_name(); } else { $this->updated_by_name = null; } $this->updated_by = $updated_by; return $this; }