John is in rare form today, first urging people to add code to their prototypes and now suggesting that we abandon Bit math because it's too much effort? I suspect someone has kidnapped my friend, John, and is making him type these crazy things.
First to answer your question, the only problem you're having is that you're effectively trying to add usergroups together. Nothing wrong with that, but you need to use BitOr(). Example: <cfset read = 1> <cfset delete = 2> <cfset edit = 4> <cfset create = 8> <cfset archive = 16> <cfset download = 32> <cfset clone = 64> <cfset groupA = read + edit + create> <cfset groupB = read + create + clone> <cfset hal = BitOr( groupA, groupB )> <cfoutput> #BitAnd( hal, delete )# </cfoutput> will return 0. Personally, I think the cf_secure tag is clearer and a heck of a lot nicer than dragging around an interminably long list of text, but that's just my opinion. -----Original Message----- From: John Quarto-vonTivadar [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 1:29 AM To: [EMAIL PROTECTED] Subject: Re: secure tag and permissions why not just get away from the bitwise permissions...? that is one of those things that sounds really great, and then in the end I'm not convinced delivers anything worth the effort (as opposed to a textual-based permission codes like "AdminForumList, AdminAddForum" etc. sure the math looks kewler, but i find it just as useful to be able to look at a list of English permission words and say "hey is this permission in the list?" "Brooklyn, NY" versus "11222-4401". Yes, the second has more precise information. But ask someone from Esland which one is easier to find on a map, and I bet the first one generates a faster associative memory link. as for your actual question: what happens if the User group has a permission that Anon group already has? aren't you then adding it twice? (see what I mean? I'd find it a hell of a lot easier to debug to just ask "hey are these permissions in the list?") ----- Original Message ----- From: "Toby Tremayne" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, April 04, 2002 1:02 AM Subject: secure tag and permissions This has got me stumped. I thought I'd grokked the bit permissions system, but I must be wrong - this is my permissions file: permissions = structNew(); permissions.admforumList = 1; permissions.admaddForum = 2; permissions.admeditForum = 4; permissions.admsaveForum = 8; permissions.admdeleteforum = 16; permissions.forumList = 32; permissions.threadlist = 64; permissions.viewthread = 128; permissions.addthread = 256; permissions.editThread = 512; permissions.saveThread = 1024; permissions.deleteThread = 2048; permissions.addMessage = 4096; permissions.editMessage = 8192; permissions.saveMessage = 16384; permissions.deleteMessage = 32768; permissions.anonGroup = permissions.forumList + permissions.threadList + permissions.viewThread; permissions.userGroup = permissions.addthread + permissions.saveThread + permissions.addMessage + permissions.editMessage + permissions.saveMessage + permissions.anonGroup; permissions.adminGroup = permissions.admforumList + permissions.admaddForum + permissions.admeditForum + permissions.admsaveForum + permissions.admdeleteForum + permissions.editThread + permissions.deleteThread + permissions.deleteMessage + permissions.userGroup; all well and good. But if I use the secure tag thus: requiredPermission="#permissions.userGroup#" userPermissions="#permissions.anonGroup#" it returns true! how can that be? Could someone please draw me a picture because I'm obviously not getting it... Toby ------------------------------------------------------------------------ ---- -------- Life is Poetry, write it in your own words ------------------------------------------------------------------------ ---- -------- Toby Tremayne Senior Technical Consultant Code Poet and Zen Master of the Heavy Sleep Lyricist Software www.lyricist.com.au m: +61 416 048 090 icq: 13107913 ==^================================================================ This email was sent to: [email protected] EASY UNSUBSCRIBE click here: http://topica.com/u/?bUrFMa.bV0Kx9 Or send an email to: [EMAIL PROTECTED] T O P I C A -- Register now to manage your mail! http://www.topica.com/partner/tag02/register ==^================================================================
