Skip to content
Discussion options

You must be logged in to vote

There's no artisan command that promotes an existing user. snipeit:create-admin only creates a new one. You can do it from tinker though, from the same directory:

php artisan tinker
$u = App\Models\User::where('username', 'jane.doe')->firstOrFail();
$p = json_decode($u->permissions ?: '{}', true) ?: [];
$p['superuser'] = 1;
App\Models\User::whereKey($u->id)->update(['permissions' => json_encode($p)]);

Use the username exactly as it appears in Snipe-IT (with SSO this is often the email address). Permissions are stored as a JSON string on the user, and superuser set to 1 is what User::isSuperUser() checks. This keeps the user's other permissions as they are. The query-level update() skips …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by snipe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants