database User (1 Viewer)

georg7

Registered User.
Local time
Today, 04:39
Joined
Sep 3, 2019
Messages
84
Hi there, I want to add Usergroups like admin and viewer to my db.
Admin can everything and Viewer can only view not edit. Is it possible to sperate them by Microsoft User?
When an admin opens the db he can see everything. Viewer only sees the opened form (menu). the Navigation is not visible.

Best regards.
georg
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 19:39
Joined
May 7, 2009
Messages
19,244
create a User table with ff fields:

UserName (Text)
Password (Text)
IsAdmin (Boolean)

fill the table with names of users and their password.
tick the IsAdmin field if the user is admin.

create a Login form that will ask for Username and password.
verify the Entry against this table.
If the user is a verified Admin, add code to show the navigation pane.
otherwise hide it.
 

Ranman256

Well-known member
Local time
Today, 07:39
Joined
Apr 9, 2015
Messages
4,337
I have a tUser table.
Name,UserID,Level

Bob,b.smith,mgr
Jen,jjones,adm
Dan,dadas, ''

When the main form opens at start,grab the userID,
Lookup their rights level,
Then disable buttons on the screen accordingly.

GvUserID=environ("username")
GvUserLevel =Dlookup("[level]","tUsers","[userID]='" & gvUserID & "'")

BtnEdit.enabled =gvUserLevel="Admin"
 

Micron

AWF VIP
Local time
Today, 07:39
Joined
Oct 20, 2018
Messages
3,478
I use levels as well, but in tblUser the level is numeric. It's related to tblLevels, which has them listed in ascending numeric order along with a descriptive field for level names (e.g. | 5 | Admin | ). When opening a form you can control the result by simply comparing (e.g. IF user level = 3 then...). However, in cases that use aggregated permissions you can also use >= or <= operators because your levels are numeric. Thus, IF userLevel <= 3 then ...)
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 06:39
Joined
Feb 28, 2001
Messages
27,186
@georg7 - first question: Do you have a formal domain that you must log in to get into your network? If so, you might not need to have a login form.


This shows you a function that you could use (if you have a formal domain that requires login to get to the network). Doing it this way, you don't have to ask who someone is by posting a form, you know simply by asking the O/S via that API call. If you have an Opening Form, you can put this in the form's Form_Load routine and define it in some place like a TempVar or in a public variable in general module. (Several ways to do this, pick your poison as to how to remember it.)

Then all you need to know is their domain login name and look up their role in a table that holds such things for you.

You can find ALL SORTS of info on where to go from there by doing a search of this forum for "user role" - and there must be hundreds of posts on that subject over the years.
 

georg7

Registered User.
Local time
Today, 04:39
Joined
Sep 3, 2019
Messages
84
Thank you guys I'll try it all :D
Have a nice Weekend !
 

Users who are viewing this thread

Top Bottom