3 ms·
Yes, I only want the object to "see" code it has access to and I don't want to accomplish this by asking "can I access this method/function?" every time I call
by harrylove 15y ago
Yes, I only want the object to "see" code it has access to and I don't want to accomplish this by asking "can I access this method/function?" every time I call it. For example, when I repeatedly attempt to perform a task that would be granted to the "Admin" role, I don't want the code to ask me if I'm an admin, or part of a group of admins, or if my role is able to access methods granted to admins, etc. By virtue of me logging in, the app instance should reconfigure itself for admins. When someone else authenticates with a different role (or roles) the app should configure itself for that purpose.
There would never be any unauthorized code access, technically speaking. There may be instances of stolen identity, of course, in which case the authentication would be valid (or hacked) but the application code would align itself with the role granted to the identity.
I'm not concerned with any particular practical implementation or application, really. I'm thinking mostly about architecture and design and programming style.
Thanks for the hint on the strategy pattern.