Dave Watts wrote:
> But in any case, since you said earlier that your permissions are binary
> values (you represent them with checkboxes), why not represent them using

Actually, in my case, they are integers... the checkboxes are on-off 
values for specific parts of the application.  If something isn't 
checked, they don't have access to it - because it doesn't appear in the 
permission list.

ie "1,3,4,5,7,9" where the checkboxes for modules 2, 6, and 8 were not 
checked.  So in my case of course, not every user has every permission flag

So if I'm looking for whether or not a user has access to module 5 
(let's say that's the FAQ editor)... then I just do <cfif 
listFind(session.permissions,5) gt 0>

Now, I could probably use a bit valuation for something like this too 
but I've never tried, and although the storage would be even smaller (I 
could store 8 permissions in a single byte)....  the code would be more 
complicated I think.

One disadvantage of doing it this way is that I can't just look in the 
database, eyeball the field content, and see that a user has permissions 
to module 5.  I can't do "on the fly" binary conversions in my head ;)

I have actually considered doing in this way in the past, I've just 
never gotten around to trying to figure it out.

And to me, it's just not worth the trouble to make such modifications to 
  an application that works fine the way it is.

Rick

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:235710
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to