user->isAdmin() && !$this->user->isRegular() ) { return false; } return true; } public function getActionRead(Request $request): StdClass { $id = $request->getRouteParam('id'); if (!$id) { throw new BadRequest(); } if (!$this->user->isAdmin() && $id !== $this->user->getId()) { throw new Forbidden(); } return $this->getService('UserSecurity')->read($id); } public function postActionGenerate2FAData(Request $request): StdClass { $data = $request->getParsedBody(); $id = $data->id ?? null; if (!$id) { throw new BadRequest(); } if (!$this->user->isAdmin() && $id !== $this->user->getId()) { throw new Forbidden(); } return $this->getService('UserSecurity')->generate2FAData($id, $data); } public function putActionUpdate(Request $request): StdClass { $id = $request->getRouteParam('id'); $data = $request->getParsedBody(); if (!$id) { throw new BadRequest(); } if (!$this->user->isAdmin() && $id !== $this->user->getId()) { throw new Forbidden(); } return $this->getService('UserSecurity')->update($id, $data); } }