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    
post Jan 2 2018, 10:58 AM

Posts: 562
Joined: 17-February 09
From: West Texas

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
post Jan 2 2018, 11:35 AM

Access Wiki and Forums Moderator
Posts: 74,153
Joined: 19-June 07
From: SunnySandyEggo


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...
Go to the top of the page
post Jan 2 2018, 12:07 PM

UA Admin
Posts: 34,301
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
post Jan 2 2018, 12:22 PM

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

FYI I believe there is a security demo database in the code archive.
Go to the top of the page
post Jan 2 2018, 01:30 PM

Posts: 18,324
Joined: 29-March 05
From: Wisconsin


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,

Go to the top of the page
post Jan 3 2018, 10:22 AM

Posts: 562
Joined: 17-February 09
From: West Texas

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    16th January 2019 - 08:08 PM