public function getJSON() { $users = $this->getRequestUsers(); $r = new UserEditResponse(); $r->setUsers($users); $r->outputJSON(); }
public function change_password($uID = false) { $this->setupUser($uID); if ($this->canEditPassword) { $password = $this->post('uPassword'); $passwordConfirm = $this->post('uPasswordConfirm'); \Core::make('validator/password')->isValid($password, $this->error); if (!Loader::helper('validation/token')->validate('change_password')) { $this->error->add(Loader::helper('validation/token')->getErrorMessage()); } if ($password != $passwordConfirm) { $this->error->add(t('The two passwords provided do not match.')); } $sr = new UserEditResponse(); $sr->setUser($this->user); if (!$this->error->has()) { $data['uPassword'] = $password; $data['uPasswordConfirm'] = $passwordConfirm; $this->user->update($data); $sr->setMessage(t('Password updated successfully.')); } else { $sr->setError($this->error); } $sr->outputJSON(); } }
public function clearAttribute() { $ur = new UserEditResponse(); $ak = UserAttributeKey::getByID($_REQUEST['akID']); if ($this->validateAction()) { $this->populateUsers(); if ($this->canEdit && in_array($ak->getAttributeKeyID(), $this->allowedEditAttributes)) { foreach ($this->users as $ui) { $ui->clearAttribute($ak); $ui->reindex(); } $ur->setUsers($this->users); $ur->setAdditionalDataAttribute('value', false); $ur->setMessage(t('Attributes cleared successfully.')); } else { throw new Exception(t("You don't have access to update this attribute.")); } } $ur->outputJSON(); }
public function getUsersJSON() { $dh = Loader::helper('concrete/user'); if ($dh->canAccessUserSearchInterface()) { if (!is_array($_REQUEST['uID'])) { $users[] = $_REQUEST['uID']; } else { $users = $_REQUEST['uID']; } $users = array_filter(array_map(function ($item) { $u = UserInfo::getByID(intval($item)); //Could not find permission with key 'view_user' // $uip = new Permissions($u); // if ($uip->canViewUser()){ // return $u; // }else{ // return false; // } return $u; }, $users)); $r = new UserEditResponse(); if (count($users) == 1) { $r->setUser($users[0]); } else { $r->setUsers($users); } $r->outputJSON(); } }
public function change_password($uID = false) { $this->setupUser($uID); if ($this->canEditPassword) { $password = $this->post('uPassword'); $passwordConfirm = $this->post('uPasswordConfirm'); if (strlen($password) < Config::get('concrete.user.password.minimum') || strlen($password) > Config::get('concrete.user.password.maximum')) { $this->error->add(t('A password must be between %s and %s characters', Config::get('concrete.user.password.minimum'), Config::get('concrete.user.password.maximum'))); } if (!Loader::helper('validation/token')->validate('change_password')) { $this->error->add(Loader::helper('validation/token')->getErrorMessage()); } if (strlen($password) >= Config::get('concrete.user.password.minimum') && !Loader::helper('concrete/validation')->password($password)) { $this->error->add(t('A password may not contain ", \', >, <, or any spaces.')); } if ($password != $passwordConfirm) { $this->error->add(t('The two passwords provided do not match.')); } $sr = new UserEditResponse(); $sr->setUser($this->user); if (!$this->error->has()) { $data['uPassword'] = $password; $data['uPasswordConfirm'] = $passwordConfirm; $this->user->update($data); $sr->setMessage(t('Password updated successfully.')); } else { $sr->setError($this->error); } $sr->outputJSON(); } }