jump to navigation

Using The SimpleACL Class February 17 2006

A few minutes ago I posted a Simple ACL Class for VB.NET

The whole idea behind an ACL is to convert human “real-world” permissions to a single number representation. This eliminates the need for setting rows and rows of bits, true / false etc within database entries.

Using this class is fairly easy as I really only have 5 tasks which I’m interested in controlling permissions for (Tasks A-E)

To start things off we instantiate the class

Private myACL As clsSimpleACL myACL = New clsSimpleACL

From there if we want to “Allow” or “Deny” various permissions, we simply call the appropriate routines within the SimpleACL object

' Allow Task A myACL. allowTask(myACL.ACLItem_TaskA)  ' Allow Task B myACL. allowTask(myACL.ACLItem_TaskB)  ' Deny Task C myACL. denyTask(myACL.ACLItem_TaskC)

Then to get a single integer representation of all the permissions that were set, simple access the property “ACLValue”

myACL.ACLValue

This value can then be saved for later usage. It you decide you want to modify the ACL permissions for a record, simple instantiate and assign the ACLValue property. Then change permissions accordingly.

Private myACL As clsSimpleACL  myACL = new clsSimpleACL  'Assign the old value from the DB  myACL.ACLValue = someOldACLValue  ' Now deny Task A myACL. denyTask(myACL.ACLItem_TaskA)  ' Re-save...

Thats it….

ACLs are great when trying to assign a million different types of permissions to users / groups / file systems etc. Plus they are fast as hell!

Comments

Sorry comments are closed for this entry