If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Unanswered: How to create Users Authority

Hello everyone
I finish my database in access 2013 but I have problem
I have in this program many Authority levels 4 or 5 levels
(Admin ,manager ,Assistant manager and User)
how I can create Authority form
if my user name and password for admin go to admin page directly or manger go to manager form ....... etc.
thanks a lot and best regards

Don't waste your time with a login form: each user is identified by his/her Windows login. You can retrieve the information using:

Code:

UserName = Environ("USERNAME")

or by using APIs (see in the codebank: http://www.dbforums.com/microsoft-ac...code-bank.html).
Create a table that contains the authorised users and their level of privilege.
All you need now is to call a procedure (from an AutoExec macro) that retrieves the level of privilege of the current user and opens the appropriate form:

traditionally a computer based security system is based on users belonging to groups
permissions are allocated to those user groups
a user can belong to many groups
when retrievng the permissions retrieve for the user group, or iterate through the user groups the current ember is part of and returnt he highest or matching permissions

environ('username') is 'good', but its easily spoofed, and easily bolluxed, retrieving the network sign on is in my view far better. I have seen an Access application (admittedly they used netware as their networking software) fail to logon to the network but the environ variable was set.

I woudl also place my code to check permissions within each object (effectivley place some code int he on open event and set cancel = true if they do not have sufficient permissions

IIRC I used a function that requested the permission and returned a boolean value indicating if the user had the correct permission
it pushes the code to validate into each object so there i sno need to to remember to request permission in menus or switchboards
the only downside is that users instead of not seeign an option they dont' have clearance to which woudl be my preferred choice as opposed to gettign a bounce message.. you donjt' have adequate permission