B4J Question Create an app with different level of privilages

bogdanc

Active Member
Licensed User
Longtime User
I waorking on the app and I would like to create 3 types of privileges:
- admin
- engineer
- operator

I was thinking to add:
sub to load encrypted file with password and other settings.
If user will pass the password then will get an access to different privileges.

Has anyone did something like that?
 

alienhunter

Active Member
Licensed User
Longtime User
Yes ,
i made this happen with mysql not with passwords , so each user has only privileges to what he needs
something like that
 

Attachments

  • userpriv.jpg
    userpriv.jpg
    202.6 KB · Views: 201
  • userpriv1.jpg
    userpriv1.jpg
    84 KB · Views: 184
Last edited:
Upvote 0

jmon

Well-Known Member
Licensed User
Longtime User
My app, "postChat" (in "share my creations") is designed to support privileges. The way I designed it is by storing multiple privileges in a single integer and retreiving the privileges using the bitwise operarions. More here : https://kinsey.no/blog/index.php/2009/11/17/storing-multiple-privilegessettings-in-a-single-integer/

So instead of storing global privileges as you mentioned, I store values such as : this person can see this page or not, can edit calendar or not, etc ...

it's very convenient as you can store that single integer in a single column in you db, and you can also issue statements with mysql such as "select every person that can modify the calendar" because mysql supports bitwise operations : http://dev.mysql.com/doc/refman/5.7/en/bit-functions.html
 
Upvote 0

bogdanc

Active Member
Licensed User
Longtime User
Yes ,
i made this happen with mysql not with passwords , so each user has only privileges to what he needs
something like that

Yes MySql it's a good solution but my app has to be independent. App has an option to communicate with DataBase.
For next project I will use DB.
 
Upvote 0

alienhunter

Active Member
Licensed User
Longtime User
Yes MySql it's a good solution but my app has to be independent. App has an option to communicate with DataBase.
For next project I will use DB.
I would not know how , unless you have predefined passwords for each occupation , you would not know which dude is a admin or a operator or they can share the passwords and let the chaos begin ... lol
i went a step further and get the computer name to be sure they are not messing around with other stuff that they do not need (100+ user ) at work .
 
Upvote 0

alienhunter

Active Member
Licensed User
Longtime User
My app, "postChat" (in "share my creations") is designed to support privileges. The way I designed it is by storing multiple privileges in a single integer and retreiving the privileges using the bitwise operarions. More here : https://kinsey.no/blog/index.php/2009/11/17/storing-multiple-privilegessettings-in-a-single-integer/

So instead of storing global privileges as you mentioned, I store values such as : this person can see this page or not, can edit calendar or not, etc ...

it's very convenient as you can store that single integer in a single column in you db, and you can also issue statements with mysql such as "select every person that can modify the calendar" because mysql supports bitwise operations : http://dev.mysql.com/doc/refman/5.7/en/bit-functions.html


now you telling me this .... ;), it is easier then my solution got the same thing but with each function is a column
 
Upvote 0

alienhunter

Active Member
Licensed User
Longtime User
It is a good idea but I need to have just one app on the PC and let an option to end user to logon with the different privileges.

Something like this are you looking for ?

B4X:
If data1=userpastxt2.Text Then
If data2="Admin" Then
Log("Admin")
mainadmin.AppStart(data0,data2,data13,data3)
Else If data2="Manager" Then
Log("Manager")
mainmanager.AppStart(data0,data2,data13,data3)
Else If data2="Leader" Then
Log("Leader")
leadermain.AppStart(data0,data2,data13,data3)
Else If data2="Employee" Then
Log("Employee")
employeesmain.AppStart(data0,data2,data13,data3)
End If


this is password driven and user login levels
 
Upvote 0
Top