Switchboard with simple security

Pat Hartman

Super Moderator
Staff member
Local time
Today, 02:12
Joined
Feb 19, 2002
Messages
45,488
This is a custom switchboard. It expands on the Switchboard Items table to add four additional columns to define view/edit/add/delete security levels for switchboard items and forms/reports referenced by them. It includes tables to manage users and also to assign them security levels. The user maintenance form and the menu maintenance form use the security to determine whether to allow the requested action. The switchboard form also uses the view security to determine whether a user even sees a switchboard item. The database opens to a logon form. It gives you three different logins so you can see low, medium, and high security at work.
CustomSwitchboard.JPG

CustomSwitchboardUpdate.JPG



THERE IS AN UPDATED VERSION FURTHER ON SO TAKE THAT ONE INSTEAD.
 

Attachments

Last edited:
This is a nice switchboard Pat. It took me a few tries to see how to add a user and the password reset confused me at first, but I get it now. I was also confused by your use of the On Unload event to open the switchboard menu back up again but now that I see how it works, I like it. Of course the before update events are where the real magic happens. Nice work.
 
Thanks Mike. Glad you like it. I've posted it a couple of times but today I posted it here to the samples. I built it a few years ago for a client who wanted to control what people saw in the menus and nothing with a fixed button layout like the Old switchboard works because hiding items leaves gaps so I had to start from scratch.

I have several customized versions of the switchboard and I use the maintenance form for them also (without the icons) because once you go with more than 8 items, it becomes a pain to use the Switchboard wizard
 
Pat, thanks again!
After review, this is indeed what I am looking for, just more complex than I'd like Hahaha.
It will take me some time to implement it (translating is slow work) but I'm sure I'll get it.
Permission to come to you with any questions?
 
Please post your questions to the forums. I'm probably not the only one who can answer them.
 
I made some minor changes and included a new sample switchboard that is based on the macro version of the MS Switchboard except that I converted it all to VBA:)

MORE UPDATES - don't use this version. See further on.
 

Attachments

Last edited:
I made some major changes most of which are not visible. But they were bug fixes which if you've used the app, you've probably already taken care of. They were caused by including the old version of the switchboard that used [Switchboard Items] and not all of the code got changed correctly to use tblSwitchboardItems. You probably didn't see the problem unless you actually imported the objects because both tables are present and so you were just not always getting the correct value for the security checks.

I also included some documentation which I hope will prove helpful and encourage you to use custom switchboard and/or the simple security.

Updated 12/31/22
 

Attachments

Last edited:
There was a question in a different thread and I referred the OP to this thread. I'm including a link as well as the text of my answer for convenience. I am also adding additional information here to expand my explanation.


There is a different example that includes basic security. There is a document that explains the basics


Remember, this is very basic. You can use it as is or you can expand it to suit your needs. This sample uses the Dept field as the "group" since that will typically be how security works. You can rename the field or use any other method you want to group people. Everyone has a unique login since you don't want people logging in as "groupA" because then you cannot identify individual activity if you want to. The concept of "group" allows you an easy way to provide the same settings for all members of a group. The app also allows you to override any setting for an individual so that it is different from his group. Look at the code in the form's BeforeUpdate event to see how it handles a change in DeptID.

So, the security is essentially a matrix. Forms are assigned the four security levels and individuals/groups are also assigned the four security levels. When a form is opened, the code matches the user's security levels for the action requested to those of the open form based on the current selection of the switchboard. This means that subforms and spawned forms (popups) inherit the security of the base form, If this doesn't work for you, you need an additional table to handle subforms and popups separately from the base form.

This sample also shows you that the custom switchboard that is powering the sample will control what each user/group sees as menu options. The login form gives you three security levels to log on with to test how this works.

There is a built in report that shows the security levels for the switchboard items. Things you can add are:
1. a similar report for users by department.
2. An update option on the Department form that allows you to propagate all changes to employees for that specific department. Keep in mind that if any user has a different setting for any of the four levels, then that uniqueness will be lost with this bulk update. If you want to deal with this, you can first run a query that finds all the employees that are different for this department on any of the four values.

This sample was based on something I built for a client. They didn't want the group option so I added that specifically to the sample but not necessarily fleshed out. As has been mentioned, dependent forms inherit the security of the form that spawned them. If this doesn't work for you, you need to expand the concept. I used the switchboard table as the simplest way to control the menuing for the users. If you want to make separate tables for each object, you can but you'll need to do something different to control the menu. The sample's custom switchboard is just a form with a subform, if you don't like the way it looks, change it to fit with the scheme of your own app. It won't hurt my feelings;) It is also based on the original [Switchboard Items] table because I personally like the way that table works. The sample includes a management form for the tblSwitchboardItems because you can't use the built in wizard once you allow more than 8 items per page. So, I also changed the table name to conform to my standards.

I remind you again. This is a sample. It is one way to implement simple security. It is sufficiently functional for you to just import all the objects into your app and just change the way they look to match the esthetic of your app. I've tried to use themes throughout so if you are also using themes, some or all of the colors/fonts will just change automagically when you import them:)

Please let me/us know if you choose to implement the suggestion in full or in part and tell us how it worked out for you.
 
Last edited:
When I put this sample together, I took forms from different applications and the security was inconsistent. I hope I cleaned all that up. Every form that allows updates should now have the proper code in the proper events. Subforms don't need code in the load and unload events but they still have code in the BeforeDelConfirm, BeforeInsert, and BeforeUpdate events.

I added a small amount of documentation on security in the database but there is a more detailed version in the included document.
 

Attachments

Users who are viewing this thread

Back
Top Bottom