Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin users? #4300

Open
AlphaJack opened this issue Aug 7, 2020 · 2 comments
Open

Admin users? #4300

AlphaJack opened this issue Aug 7, 2020 · 2 comments
Labels

Comments

@AlphaJack
Copy link

Why is there a command php artisan monica:admin, if there isn't any admin interface? Is this a planned feature?
Is there a way to add or delete user accounts without manually editing the database?

@OnSive
Copy link

OnSive commented Nov 10, 2020

You can add a user as instance admin with the following command:

...@...:/var/www/monica# php artisan monica:admin

 What is the user’s email?:
 > my@e.mail

my@e.mail will be added to the administrators of this instance

 Do you wish to continue? (yes/no) [no]:
 > yes

my@e.mail has been added to the administrators of this instance

but I do not notice any difference between with and without admin privileges.

There are only two files which reads or writes the admin status:

  • (It looks like a login check skip?)
    if ($request->user()->admin ||
    config('laravelsabre.users') == null) {
    return true;
    }
  • (The php arthisan command)
    // Print a warning
    if ($user->admin) {
    $this->warn($user->email.' will be removed from the administrators of this instance');
    } else {
    $this->warn($user->email.' will be added to the administrators of this instance');
    }
    // ask for confirmation if not forced
    if (! $this->option('force') && ! $this->confirm('Do you wish to continue?')) {
    return;
    }
    // toglle admin status
    $user->admin = ! $user->admin;
    $user->save();
    // Show new status
    if ($user->admin) {
    $this->info($user->email.' has been added to the administrators of this instance');
    } else {
    $this->info($user->email.' has been removed from the administrators of this instance');
    }

@asbiin
Copy link
Member

asbiin commented Dec 19, 2020

The goal of this command is to have and admin panel (see #1876 ) which is not available yet.

@asbiin asbiin added the bug label Dec 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants