/** * @param SS_HTTPRequest $request * @return array * @throws RestUserException */ public function delete($request) { // check param for id $data = []; try { if ($id = $request->param('ID')) { if ($id != 'me') { throw new RestUserException("No session found", 404); } AuthFactory::createAuth()->delete($request); } else { throw new RestUserException("No id specified for deletion", 404); } } catch (RestUserException $e) { throw $e; } catch (Exception $e) { throw new RestUserException("ApiSession was not found", 404); } $meta = ['timestamp' => time()]; $data['meta'] = $meta; return $data; }
/** * @return bool * @throws RestSystemException */ protected function isAdmin() { $member = AuthFactory::createAuth()->current($this->request); return $member && Permission::checkMember($member, 'ADMIN'); }
protected function currentUser() { return AuthFactory::createAuth()->current($this->request); }