Norbert Hartl wrote:

At first I created a lot of classes like AdminRole,
MemberRole, CreatePermission, ModifyPermission etc.
I used the class objects for this. These only carry
some state like index, label. The role objects also carry a set of permissions.

I'm a big fan of instances :-)

Have one Permission class, one for Role etc.

Then you can have instance creation methods (maybe via a cache)

Permission modify, Role admin

Internally you could actually use (symbol) names

Permission>>modify

^Permission new name: #modify

or

self cache at: #modify ifAbsentPut: [...]

This would make it easier to extend the role and permission model later

Permission>>named: permissionID


anAction requires: Modifypermission

anAction requires: Permission modify

Cheers

Michael
_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Reply via email to