![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
|
Directory Security
So Right now I'm working on Directory Security permissions. I have the following code:
vbnet Syntax (Toggle Plain Text)
|
|
|
|
|
|
#2 |
|
Professional Programmer
|
__________________
JG-Webdesign |
|
|
|
|
|
#3 |
|
Hobbyist Programmer
|
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.. |
|
|
|
|
|
#4 |
|
Hobbyist Programmer
|
@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. |
|
|
|
|
|
#5 |
|
Hobbyist Programmer
|
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.. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
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 |