Skip to content

Commit

Permalink
Remove unused Msg constructor and update response types
Browse files Browse the repository at this point in the history
  • Loading branch information
cayb0rg committed Nov 28, 2023
1 parent 88c56d9 commit d332555
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
8 changes: 4 additions & 4 deletions fuel/app/classes/controller/api/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function get_activity()

public function post_settings()
{
if (\Service_User::verify_session() !== true) return $this->response('Not logged in', 401);
if (\Service_User::verify_session() !== true) return $this->response(\Materia\Msg::no_login(), 401);

$success = false;
$set_meta = [
Expand All @@ -42,9 +42,9 @@ public function post_settings()

public function post_roles()
{
if (\Service_User::verify_session() !== true) return $this->response('Not logged in', 401);
if (\Service_User::verify_session() !== true) return $this->response(\Materia\Msg::no_login(), 401);
// this endpoint is only available to superusers!
if ( ! \Materia\Perm_Manager::is_super_user()) return $this->response('Not authorized', 403);
if ( ! \Materia\Perm_Manager::is_super_user()) return $this->response(\Materia\Msg::no_perm(), 403);

$success = false;
$user_id = Input::json('id', null);
Expand All @@ -53,7 +53,7 @@ public function post_roles()
'support_user' => Input::json('support_user', false)
];

if ( ! $user_id) return $this->response('User ID not provided', 401);
if ( ! $user_id) return $this->response(\Materia\Msg::invalid_input('User ID not provided'), 401);

$current_roles = \Materia\Perm_Manager::get_user_roles($user_id);
$current_roles_condensed = array_map( fn($r) => $r->name, $current_roles);
Expand Down
6 changes: 0 additions & 6 deletions fuel/app/classes/materia/msg.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,6 @@ static public function student_collab()
return $msg;
}

static public function student()
{
$msg = new Msg('Students are unable to receive notifications via Materia', 'No Notifications', Msg::NOTICE, false, 403);
return $msg;
}

static public function failure($msg = 'The requested action could not be completed', $title = 'Action Failed')
{
$msg = new Msg($msg, $title, Msg::ERROR, false, 403);
Expand Down

0 comments on commit d332555

Please sign in to comment.