-
-
Notifications
You must be signed in to change notification settings - Fork 792
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
688d07a
commit 22f306a
Showing
3 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import sys | ||
|
||
from mealie.core import root_logger | ||
from mealie.db.db_setup import session_context | ||
from mealie.repos.repository_factory import AllRepositories | ||
|
||
|
||
def main(): | ||
confirmed = input("Enter user email to assign this user admin privileges: ") | ||
|
||
logger = root_logger.get_logger() | ||
|
||
with session_context() as session: | ||
repos = AllRepositories(session, group_id=None, household_id=None) | ||
|
||
user = repos.users.get_one(confirmed, "email") | ||
if not user: | ||
logger.error("no user found") | ||
sys.exit(1) | ||
|
||
user.admin = True | ||
repos.users.update(user.id, user) | ||
|
||
logger.info("updated user %s to admin", user.username) | ||
input("press enter to exit ") | ||
sys.exit(0) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |