Oh, that's a different story.

If you are creating your own bit strings it's easy:

Use constants in application.cfm to define what each bit means:

<cfset BIT_CANEDIT = 0>
<cfset BIT_CANVIEW = 1>
<cfset BIT_CANDELETE = 2>
etc...

Then you can check them using this:
<cfif NOT BitMaskRead(client.permissions,BIT_CANEDIT,1)>
        relocate to DENIED page
</cfif>

The only caveat here is that "client.permissions" must be an integer. If you
want to store the bit string in the DB as a string then you'll have to
convert it to an integer when the user logs in.  Manipulation is also easy:

start with a permission setting of 0 and use 
BitMaskSet(client.permissions,1,BIT_CANEDIT,1) to turn the bit on and 
BitMaskSet(client.permissions,0,BIT_CANEDIT,1) to turn it off

Good luck!

+-----------------------------------------------+
Bryan Love
  Macromedia Certified Professional
  Internet Application Developer
  Database Analyst
Telecommunication Systems
[EMAIL PROTECTED]
+-----------------------------------------------+

"...'If there must be trouble, let it be in my day, that my child may have
peace'..."
        - Thomas Paine, The American Crisis



-----Original Message-----
From: Brian Ferrigno [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 07, 2002 12:53 PM
To: CF-Talk
Subject: RE: Directory permission bitwise operation help needed


Thanks for the reply Lewis. 

What I am looking for is a lot less complicatedthan CFX-Permissions and also
necessary to run on both Windows and Linux. I basically want to be able to
set a permissions string for a user in the database and use a mask to test
if a certain bit string is set. If it is the user has permission to perform
a certain action

Ex.
10101010 permission string
00000010 mask
--------
00000010 user has permission to perform this action

I just wanted to know if there was anything more involved in this other than
just doing the above masking operation. I'm sure there is, but it's Friday
and I can only think about the weekend right now.

I'll also take a look at your custom tag and bug you if I have any
questions.

Thanks for your help.


Brian

-----Original Message-----
From: Lewis Sellers [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 07, 2002 3:34 PM
To: CF-Talk
Subject: Re: Directory permission bitwise operation help needed


On Fri, 7 Jun 2002 11:41:55 -0700, in cf-talk you wrote:

>I believe Lewis Sellers can help you.  He has written CFX tags to
manipulate
>users and permissions.  You'll find posts from him on this talk list...


Yep. Though the phrase "I've forgotten more than you'll ever know"
might apply here.

Many moons and years ago I wrote a tag called CFX_Permissions for the
IHTK (which is free now btw and open-sourced).

CFX_Permissions lets you modify the permission settings of files and
folders under NT. It also does extended directory listings which
included the permissions for all the files/folders you tell it to look
at. It also lists SIDs, and NT Account names for the owners of the
files/folders.

Very handy for web hosting and intranet security (hense it's inclusion
in the Intranet/Hosting Toolkit. :).



I don't offhand recall the exact bits you have to set for each of the
permissions types... though I can tell you wasn't exactly a simple set
up. We're talking something designed by microsoft here after all. But
if you poke around the request.cpp in the cfx_permissions source
everything should be there... in C though. 

If you don't understand how it works... just ask. I might remember how
it worked. /-)

--min




______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to