Skip to content
Advertisement

How to assign different permissions to users with different levels in Python?

I’m creating a simple login GUI. I’m trying to make it so that level 3 users can access all requests, level 2 users can only access database and sales related requests, and level 1 users can only access the sale requests.

However, I’m stuck on trying to retrieve the level info and using it in the if- else statement.

JavaScript

Full code:

JavaScript

If possible, please provide some examples.

Advertisement

Answer

You need to save the user level from the user credential file before executing login_success() inside login_verify() function:

JavaScript

Then using this user level in database_request() function:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement