UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Switchboard Filters, Access 2016    
 
   
airplayne
post Jan 2 2018, 10:58 AM
Post#1



Posts: 497
Joined: 17-February 09
From: California


Does anyone know if it is possible to limit options in a switchboard based on roles? For example I would like to hide an option to navigate to an admin area if the person logged in does not have that role. Is this something that can be done in the normal list of options or would it have to be done in the footer?
Go to the top of the page
 
theDBguy
post Jan 2 2018, 11:35 AM
Post#2


Access Wiki and Forums Moderator
Posts: 71,430
Joined: 19-June 07
From: SunnySandyEggo


Hi,

I don't think this feature is built into the Switchboard. However, you should be able to modify the code behind the form to add the "role" feature as you want it to work.

Just my 2 cents...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
GroverParkGeorge
post Jan 2 2018, 12:07 PM
Post#3


UA Admin
Posts: 31,632
Joined: 20-June 02
From: Newcastle, WA


While the classic Switchboard does support role based menus directly, there's no reason you couldn't add that function.

You'll need to have, at least, a table of roles and some way to assign users to roles; that's probably a third, junction table. Then you can modify the switchboard code to check the role of the currently logged in user before allowing them to open an object.

Also, since the switchboards are actually table driven, you should be able to modify the way they are loaded to limit the options presented, using the same roles, users, and users-in-roles tables.

So, yes, this could be done in a couple of different ways, I think.

--------------------
Go to the top of the page
 
projecttoday
post Jan 2 2018, 12:22 PM
Post#4


UtterAccess VIP
Posts: 8,817
Joined: 10-February 04
From: South Charleston, WV


FYI I believe there is a security demo database in the code archive.

--------------------
Robert Crouser

Go to the top of the page
 
doctor9
post Jan 2 2018, 01:30 PM
Post#5


UtterAccess Editor
Posts: 18,022
Joined: 29-March 05
From: Wisconsin


airplayne,

If you are using the built-in Switchboard form that comes with Access, and you only have two possibilities (i.e. Admin or Non-admin), you can add a Boolean field to the Switchboard table. Then, in the form's FillOptions subroutine, you could alter the SELECT statement to filter out the admin choices if the logged-in user is not an admin.

Another option: Create a single switchboard menu of Admin commands, and from your main switchboard have a link to that menu. Then, in the HandleButtonClick subroutine, if the user clicks on the option to open the admin menu, check whether the user is allowed to see that menu before displaying it.

Do you have anything in place that at least determines whether the currently logged-in user is an admin or not?

Hope this helps,

Dennis

--------------------
(;,;) Li'l Cthulu says: Please talk about what you're trying to do, as well as how you're doing it.
Changing your real table name to "Table1" and your real form name to "Form1" in your posts makes it more difficult to understand what's going on, not easier.
Guidelines for Posting Questions
Go to the top of the page
 
airplayne
post Jan 3 2018, 10:22 AM
Post#6



Posts: 497
Joined: 17-February 09
From: California


I do have a table of users and have identified them as either user or administrator, so that is already set. I just wanting to see if it was possible to filter the options shown in the switchboard based on the current user that is logged in, which it looks like it is.

I will take a look through the code behind the switchboard and play around with it based on your suggestions.

Thanks everyone!
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    21st January 2018 - 03:40 PM