Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 11th, 2007, 11:31 PM   #1
PhilBon
Hobbyist Programmer
 
PhilBon's Avatar
 
Join Date: Nov 2005
Posts: 171
Rep Power: 3 PhilBon is on a distinguished road
Send a message via AIM to PhilBon Send a message via MSN to PhilBon
Directory Security

So Right now I'm working on Directory Security permissions. I have the following code:
vbnet Syntax (Toggle Plain Text)
  1.  
  2. MsgBox("hi")
  3. Dim myacc As New DirectorySecurity
  4. myacc.AddAccessRule(New FileSystemAccessRule("MyUser", FileSystemRights.FullControl, AccessControlType.Allow))
  5. IO.Directory.CreateDirectory("Test",myacc)
Which creates a directory "Test" and then tries to set a new access control to it. The problem is the Directory Security settings has inherit on automatically, How do I turn that off? And by turning that off will it automatically allow me to do what I need it to do, being remove all the users and setting "MyUser" to be the only one with access to it? I also need to set the owner of the directory. I've just been working on it for about an hour and at the point of "giving" up until another time. UGH
PhilBon is offline   Reply With Quote
Old Jul 12th, 2007, 12:03 AM   #2
Wizard1988
Professional Programmer
 
Wizard1988's Avatar
 
Join Date: Oct 2005
Location: Chitown
Posts: 416
Rep Power: 3 Wizard1988 is on a distinguished road
Send a message via AIM to Wizard1988
Is this of any help??

http://geekswithblogs.net/khanna/arc.../12/46033.aspx
__________________
JG-Webdesign
Wizard1988 is offline   Reply With Quote
Old Jul 12th, 2007, 8:06 AM   #3
john Wesley
Hobbyist Programmer
 
john Wesley's Avatar
 
Join Date: May 2006
Location: United Kingdom
Posts: 119
Rep Power: 3 john Wesley is on a distinguished road
Send a message via MSN to john Wesley Send a message via Yahoo to john Wesley
Yeah the chances are the directory should already exist - so if you create it, then alter access rules it should work, if you as the user running the program have the rights to do so.

try something like this, although its in C# should be easy to translate, if you need help tell me...

            
            DirectoryInfo di = Directory.CreateDirectory("Test");
            DirectorySecurity ds = di.GetAccessControl();
            ds.AddAccessRule(new FileSystemAccessRule(
                "MyUser", FileSystemRights.FullControl, AccessControlType.Allow)
            );
__________________
Mona Lisa must of had the highway blues you can tell by the way she smiles..
john Wesley is offline   Reply With Quote
Old Jul 12th, 2007, 8:38 AM   #4
PhilBon
Hobbyist Programmer
 
PhilBon's Avatar
 
Join Date: Nov 2005
Posts: 171
Rep Power: 3 PhilBon is on a distinguished road
Send a message via AIM to PhilBon Send a message via MSN to PhilBon
@Wizard: That helps a little in the sense of looping through each of the User Permissions.
@John: Thats what I had before and it would not work, as well as you are missing the part where you apply the access rules to the folder.

What I'm currently having problems is, setting the owner of a folder and then making it so it wont inherit permissions, but will have the ability to replace on lower objects. No inherit so that no matter where you put the folder, the people will always have access to it. Replace Permissions on Child objects because I have a System like this:
User Folder
.....User Documents
.....User Desktop
.....User Scripts
.....User Shared
As well as when I do the Code in my OP, It will add the user, but wont set any permissions. I will probably be working on it about 11 to 12 hours from now. Thanks for all your help.
PhilBon is offline   Reply With Quote
Old Jul 12th, 2007, 10:52 AM   #5
john Wesley
Hobbyist Programmer
 
john Wesley's Avatar
 
Join Date: May 2006
Location: United Kingdom
Posts: 119
Rep Power: 3 john Wesley is on a distinguished road
Send a message via MSN to john Wesley Send a message via Yahoo to john Wesley
Are you getting any exceptions on execution of the code?

If so what are the details?

Does the user belong to a domain? ie Can the name be passed as "Domain\\MyUser"?

I cant see the problem with my code, once the SetAccessControl method has been called relevantly - though the MSDN documentation yields this:

Directory Security Example

The only difference I can see is that the directory creation and information object instantiation occur as individual statements (ie, the directory already exists, or would have been created earlier), not that it should alter behaviour any.
__________________
Mona Lisa must of had the highway blues you can tell by the way she smiles..
john Wesley is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Determining the contents of a directory grimpirate PHP 2 Nov 5th, 2006 3:59 PM
Allow user to select a directory MegaArcon HTML / XHTML / CSS 11 Jun 5th, 2006 8:38 AM
Is Hotmail Or The Email Server Becoming Low In Security? pr0gm3r Coder's Corner Lounge 13 Oct 14th, 2005 7:00 PM
how to recursively copy or move part of a directory limited by size? linuxpimp20 Bash / Shell Scripting 2 Jul 6th, 2005 11:51 AM
Directory Nellie C++ 11 Jun 8th, 2005 4:31 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:34 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC