Restricting certain users groups to read only for certain folders

Hi
I'm not sure if this is the correct forum, but hey, hopefully someone might now the answer or direct me to the correct one.
I'm writing a VB program to amend ACLs for specific user groups.
Effectively, I make all prior year folders read only, whereas the default for the group is Modify, Delete etc.  This means they can continue to work in the "new year folders", but historic years is List/read only.
I've got to the point the program does everything I want, i.e. stops folder creation7deletion, file & folder name changes, copying for the historic years, but does not prevent deletion of files in the folder.  Effectively I set Deny access on the
historic folders.
Testing using the Windows GUI would appear to resolve the problem is I change the Deny Special Permission (for the group) from "This folder only" to "This folder & files".
Question then is how to I set this in VB, the default appearing to be "This folder only"
Here's extract of my code
Thanks
IfvarDirectoryName.IndexOf("\"&
Date.Now.Year) = -1
Then
            FileAcl3.AddAccessRule(
NewFileSystemAccessRule(GroupAdmin(0),
FileSystemRights.Modify,
AccessControlType.Deny))
            FileAcl3.AddAccessRule(
NewFileSystemAccessRule(GroupAdmin(0),
FileSystemRights.DeleteSubdirectoriesAndFiles,
AccessControlType.Deny))
            FileAcl3.RemoveAccessRule(
NewFileSystemAccessRule(GroupAdmin(0),
FileSystemRights.ReadAndExecute,
AccessControlType.Deny))
            FileAcl3.RemoveAccessRule(
NewFileSystemAccessRule(GroupAdmin(0),
FileSystemRights.ListDirectory,
AccessControlType.Deny))
Dim FileInfo3 As IO.FileInfo = New IO.FileInfo(varDirectoryName)
Dim FileAcl3 As New FileSecurity
If varDirectoryName.IndexOf("\" & Date.Now.Year) = -1 Then
FileAcl3.AddAccessRule(New FileSystemAccessRule(GroupAdmin(0), FileSystemRights.Modify, AccessControlType.Deny))
FileAcl3.AddAccessRule(New FileSystemAccessRule(GroupAdmin(0), FileSystemRights.DeleteSubdirectoriesAndFiles, AccessControlType.Deny))
FileAcl3.RemoveAccessRule(New FileSystemAccessRule(GroupAdmin(0), FileSystemRights.ReadAndExecute, AccessControlType.Deny))
FileAcl3.RemoveAccessRule(New FileSystemAccessRule(GroupAdmin(0), FileSystemRights.ListDirectory, AccessControlType.Deny))
FileInfo3.SetAccessControl(FileAcl3)
End If

Ho Rohn
Your right, when I added the flags I got the following error at execution
{"No flags can be set. Parameter name: inheritanceFlags"}
I've developed a work around, which gives me exactly - subject to further testing - what I want.  I simply mark each file in the relevant folders with a Deny Delete option.
I will however explore the DirectorySecurity class option, but initial review of the www seems a little shy on VB examples.
Thanks
Perry
You should be able to use FileSecurity and DirectorySecurity the same way (they have identical methods). Since this is a scripting forum, I'll provide a PowerShell example (which is fairly close to C# and VB; they all use the exact same classes):
$varDirectoryName = "c:\folder"
$GroupAdmin = "Admin Group"
$FileInfo3 = New-Object System.IO.DirectoryInfo $varDirectoryName
$FileAcl3 = $FileInfo3.GetAccessControl()
$FileAcl3.AddAccessRule((New-Object System.Security.AccessControl.FileSystemAccessRule (
$GroupAdmin,
[System.Security.AccessControl.FileSystemRights]::Modify,
([System.Security.AccessControl.InheritanceFlags]::ContainerInherit -bor [System.Security.AccessControl.InheritanceFlags]::ObjectInherit),
[System.Security.AccessControl.PropagationFlags]::None,
[System.Security.AccessControl.AccessControlType]::Allow
$FileInfo3.SetAccessControl($FileAcl3)
I could have taken a lot of shortcuts when using the enumerations, but I think keeping it verbose helps show how similar the code can be.
Does that make sense?

Similar Messages

  • Files or folders created by one user show as read only for others

    We are using Server version 3.2.2, we have a group call production and then we have 9 users plus the administrator account.  All users are assigned to the production group.  We have a single share called customers and the group "production" has read and write permissions for the share and also for all the underlying folders and files.
    Each user logs onto the share with their own username and password.  But, when a user creates a new file or folder on the server within the "customers" share, they are assigned read and write permissions and everyone else is assigned "no access".
    We then go into the folder on the server and assign the group "production" read and write access and life goes on, but the issue is that we should not have to.
    From this description, can anyone tell me what we are doing wrong?

    In the sidebar of the Server.app window, select the icon at the top with the name of the server. Then select the Storage tab in the main window pane.
    Navigate to the folder in question and select it. From the popup menu at the bottom with a gear icon, select
              Edit Permissions...
    Verify that the permissions are what they should be, and make changes if necessary. Then, from the same menu, select
              Propagate Permissions...
    Check all applicable boxes, including Access Control List. If in doubt, check all boxes. Click OK.

  • Can a Column in a Project Plan be set to Read Only for everyone except Admins

    At my company the Project Server Admins create the initial project plans.  We want to add a new column that will designate each task in the plan as Capital or Operational.  We do not want anyone to have the ability to change these.
    When the Project Managers need additional tasks on their plans they will need to copy an existing one in order to have this piece of information pre-populated on their new tasks, since we do not want them deciding what the task should be themselves and populating
    the field as they create tasks.

    In addition to Dale's excellent answer, I'd mention that it is possible to make a column "read-only" for certain security groups in MS Project Pro with VBA code. 
    That being said, I'd suggest to follow Dale's advice using a "soft" solution.
    Hope this helps,
    Guillaume Rouyre, MBA, MCP, MCTS |

  • How to make form field read only for users with certain permissions

    We need to make two form fields read only for users with certain permissions. Kindly guide me on how to do this in Infopath. I searched and there is an option to disable to the column, but no option to select user permissions. 
    Please give your suggestion on this. 
    thanks.

    Hi,
    See the link below:
    http://info.akgroup.com/blog-0/bid/69277/InfoPath-Restrict-visibility-to-users-in-a-SharePoint-Group
    Here you can add the fomatting action on the field to disable the field if those users belong to certain Sharepoint group (does not matter the permission levels though). Hope it helps.
    Regards, Kapil ***Please mark answer as Helpful or Answered after consideration***

  • Possible to make an item editable for certain users and read only for other

    Is it possible to make an item editable for certain users and read only for others?
    I've been able to accomplish this by taken the select statement that I used to define an authorization scheme, placing it in the Read Only condition of the item. However, I would like to simply reference the authorization scheme to utilize caching, and to help keep things cleaner for future maintenance.
    Is it possible to reference an authorization scheme in an item condition similar to the way another item can be referenced by preceding it with a colon (i.e. :P1_First_Name)?

    Thank you, your suggestion worked.
    It would be nice on a future release of APEX if a drop-down box existed under the Ready Only section that would allow an existing Authorization Scheme to be selected or negated when applying the Read Only attribute to a form item.

  • Generating RAR Alerts for just certain user groups

    Is there any way to limit a RAR Critical Actions Alert to just certain users?  Or, only if these users access certain data?
    We've had a request to monitor and send out a notification for some transactions, but only for certain users.  These transactions are available to many employees, but it is only a concern if someone from a certain group uses them.  Even then, it's only a concern if they access certain data.
    As an example (this is not the actual request), you have a transaction like say XD 03 (Customer Display) and its available to most everyone in the company.  You also have customers assigned to different company codes.  The issue then is that you have a certain group of users that are only supposed to look at customers for just one specific company code.  Ideally, you would want to be notified if they use this transaction to look at customers for other company codes.  At the very least, you want to know when they use this transaction so you would know to check on their usage.
    If this can't be done using the RAR Alerts, is there maybe another way to perform this montoring/notification?
    Thanks.

    Hi Bob,
    GRC RAR would not help you in this case. However you can restrict the Users through Roles which are assigned to them.
    For example : for tcode XD03 check maintain the authorization object F_KNA1_BUK with Activity 03 and Company code 1000 (depending upon your requirement). Assign the Role to User who require the access to view the Customers for the company 1000.
    Hopefully this may meet your expectations.
    Regards,
    Nikita Sharma.

  • 206 unable to set alert only for certain group

    Hi,
    is it a symbian unwanted feature that user is unable to set Nokia 206
    profile to alert for certain group (even though this kind of functionality is
    available on this phone)?
    To be more precise user is able to set profile to alert only for certain
    group but this setting has no effect (phone rebooted, groups recreated, etc. no effect)
    This feature has been available and workin in previous Nokia phones
    since last decace - is it a software quality issue or what.
    Best regards,
    Hez

    It is the Application Pool account making the query to retrieve the groups, so you would need to establish a trust from Domain B -> A.
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • All USB drives mount as read only for user

    I have searched a bunch and thee results I find seem to be irrelevant to my situation. Most relate to a single USB media that is a problem and won't read or write.
    On a new Arch install on a new computer (my third base system install). Running Gnome.
    All USB mass storage devices mount as read only for the logged in user. Root has write permissions and I can mkdir no problem. It is not an issue with the USB drive itself as this occurs with multiple USB media (I've tested several SD cards on a reader and at least two drives, all the media works correctly on my existing installations)
    I'm posting the contents of my /etc/group file in case there's an obvious error there I don't see, and my dmesg output upon plugging in the drive. User name is changed in the group file posted to "archie"
    This is a single-user system.
    /ect/group
    root:x:0:root
    bin:x:1:root,bin,daemon
    daemon:x:2:root,bin,daemon
    sys:x:3:root,bin
    adm:x:4:root,daemon
    tty:x:5:
    disk:x:6:root
    lp:x:7:daemon
    mem:x:8:
    kmem:x:9:
    wheel:x:10:root,archie
    ftp:x:11:
    mail:x:12:
    uucp:x:14:archie
    log:x:19:root
    utmp:x:20:
    locate:x:21:
    rfkill:x:24:
    smmsp:x:25:
    http:x:33:
    games:x:50:
    lock:x:54:
    uuidd:x:68:
    dbus:x:81:
    network:x:90:
    video:x:91:
    audio:x:92:
    optical:x:93:
    floppy:x:94:
    storage:x:95:
    scanner:x:96:
    power:x:98:
    nobody:x:99:
    users:x:100:archie
    systemd-journal:x:190:
    archie:x:1000:
    avahi:x:84:
    polkitd:x:102:
    rtkit:x:133:
    gdm:x:120:
    brlapi:x:999:
    kvm:x:78:
    ntp:x:87:archie
    dmesg output
    [ 968.044188] usb 4-3: new high-speed USB device number 4 using ehci-pci
    [ 968.170628] usb-storage 4-3:1.0: USB Mass Storage device detected
    [ 968.171435] scsi7 : usb-storage 4-3:1.0
    [ 969.174450] scsi 7:0:0:0: Direct-Access Generic USB SD Reader 1.00 PQ: 0 ANSI: 0
    [ 969.175068] scsi 7:0:0:1: Direct-Access Generic USB MS Reader 1.03 PQ: 0 ANSI: 0
    [ 969.939417] sd 7:0:0:0: [sdb] 15572992 512-byte logical blocks: (7.97 GB/7.42 GiB)
    [ 969.941028] sd 7:0:0:0: [sdb] Write Protect is off
    [ 969.941037] sd 7:0:0:0: [sdb] Mode Sense: 03 00 00 00
    [ 969.944664] sd 7:0:0:1: [sdc] Attached SCSI removable disk
    [ 969.945509] sd 7:0:0:0: [sdb] No Caching mode page found
    [ 969.945517] sd 7:0:0:0: [sdb] Assuming drive cache: write through
    [ 969.952682] sd 7:0:0:0: [sdb] No Caching mode page found
    [ 969.952693] sd 7:0:0:0: [sdb] Assuming drive cache: write through
    [ 969.956396] sdb: sdb1
    [ 969.965003] sd 7:0:0:0: [sdb] No Caching mode page found
    [ 969.965011] sd 7:0:0:0: [sdb] Assuming drive cache: write through
    [ 969.965015] sd 7:0:0:0: [sdb] Attached SCSI removable disk
    I'm sure I'm just missing something in user management, but I can't find what.
    Last edited by hooya (2014-04-27 03:10:49)

    I am also having the same problem. Root can read and write to automounted drives, but my user cannot. I've tried with a variety of drives, I am assuming they are being automounted by root instead of the logged-in user somehow. (I am running x directly, and am not using a display manager, if that has anything to do with it).
    When I look at how it is mounted it is as follows:
    /dev/sdc1 on /run/media/myuser/drivename type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)

  • Read Only for "Group" and "Others" via SMB

    I see when Windows vista users of my OS X 10.5.8 server save a file to the server, the permissions show on the server as Read & Write for the owner and Read Only for 'Group' and 'Others'.
    Is there a way I can make the OS X server always make 'Group' and 'Others' always be Read & Write?
    Thanks!

    It's using a shared component LOV cleverly called LOV_YN which consists of a static LOV with
    1 Display=Yes, Return=Y
    2 Display=No, Return=N
    The settings in the LOV section on the item iteself:
    Named LOV: LOV_YN
    Display Extra values: No Dynamic translation: Not translated
    Number of columns: 2 Display null: No
    Null display value is blank as is null return value
    Item was setup as a radio group and was only converted over to a select list to work around this issue. Let me know what else you need and thanks again.
    Rgds/Mark M.

  • Restrict password resets to certain user groups in UME

    I am investigating if it is possible to create a UME action which restricts admins to unlocking/locking IDs and resetting passwords for users in a certain user group.  I know you may need to create a UME permission class and action.  Has anyone done this?  If so how?
    Thanks and Regards,
    Mosi

    Hi Mosi,
    did you have a look at the <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/2b/306bb5bc98f24f8a85d489449af456/frameset.htm">Documentation about the Company Concept</a>? This can also be used to delegate administrative taks in your case.
    Regards,
    Patrick

  • How to create sharepoint Group with read only permissions using powershell for entire site ?

    How to create sharepoint Group with read only permissions using powershell for entire site (including subsites and top level site)

    Hi
    using (SPSite site = new SPSite(url))
    using (SPWeb web = site.OpenWeb())
    SPUserCollection users = Web.AllUsers;
    SPUser owner = users[string.Format("{0}{1}", "Domain", "Owner Username")];
    SPMember member = users[string.Format("{0}{1}", "Domain", "Default Member Username")];
    SPGroupCollection groups = Web.SiteGroups;
    string GroupName = “Super Exclusive”;//your group name
    string GroupDescription = “Super exclusive group description.”;
    groups.Add(GroupName, owner, member, GroupDescription);
    SPGroup NewSPGroup = groups[GroupName];
    SPRoleDefinition role = Web.RoleDefinitions["Read"];
    SPRoleAssignment roleAssignment = new SPRoleAssignment(NewSPGroup);
    roleAssignment.RoleDefinitionBindings.Add(role);
    Web.RoleAssignments.Add(roleAssignment);
    Web.Update();
    Please 'propose
    as answer' if it helped you, also 'vote
    helpful' if you like this reply.

  • Make UDF Read-only for all users

    Hi
    Can i use any script to make a UDF read-only for all users?
    i am looking at CPRF and CUFD Tables
    thanks

    Hi,
    You should never try updating system table directly.  That will against supporting policy by SAP.
    Thanks,
    Gordon

  • Text Mandatory only for Certain Materials in Sales Order

    Is there anyway so that I can make certain item text mandatory only for certain materials?
    I tried creating new item category group and new item category. And then create new Text procedure making this text mandatory and assigning to this new item category.
    But there are lot of different types of item categories assigned. So it does not look good to create new item category for each and everyone for this new item category group and material.
    Please guide me how to make the document incomplete for certain materials only when one text is not filled at item level
    Thanks in advance

    Hi,
    what you tried is correct and that is been followed in most of my projects wherever I worked.  That is the best way recommended also.
    If you try with incompletion procedures for item category also, you will endup doing multiple item categories anyway....
    First when I looked at the subject line, even before I opened your POSTING, I got the same resolution as you did....May be the optimal one but, not sure, if something else is possible other than by doing user exit.
    Regards

  • Howto make created folders/ files from one teacher, read only for other teachers?

    Hello there,
    as an admin @ school I was wondering how to make created folders/ files from one teacher, read only for other teachers?
     - In a 2008domain, created a group "teachers"
     - created a folder "teacher data" where all teachers have read/write permissions
    ideal,a teacher who make's a folder in "teacher data" should be the only oen who is able to add file's to that folder and dele that folder or files. Other teachers may be able to read the content of the folder.
    Is this possible to set up and how?
    many thanks.
    Nico.
    rds

    Hi Nico,
    You could set the permissions below to resolve the issue:
    For the root folder "teacher data": give the full control permission to CREATOR OWNER – "Subfolders and files only" and give the read/write permissions to the group "teachers"– "This folder only".
    Best Regards,
    Mandy 
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • HT4796 I did all of the above and the migration was successful, but I don't know where the files are.  It says they're under a different user, 'owner' .  I tried to access via sys pref/system/users&groups, but it asks for a password for owner which I don'

    Migration Assit , PC to MAC - The migration was successful, but I don't know where the files are.  It says they're under a different user, 'owner' .  I tried to access via sys pref/system/users&groups, but it asks for a password for owner which I don't have.  What must I do to access my files?
    My experience is with MS PC's I'm new with the MAC Book Pro.

    Then, see if this works:
    Mac OS X 10.6 Help- If you forget your administrator password
    If you are running Lion or Mountain Lion you may need to do the following to access the same utility:
    Boot to the Recovery HD:
    Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
    When the menubar appears select Terminal from the Utilities menu. Enter resetpassword at the prompt and press RETURN. Follow instructions in the dialog window that will appear.
    Or see Reset a Mac OS X 10.7 Lion Password and OS X Lion- Apple ID can be used to reset your user account password.

Maybe you are looking for

  • Example of how to call a BadI from an Abap and use the NEW OO ALV Grid

    Very easy to do. <b>REPORT  Z_BADI_TEST. test call Badi from standard abap. *Only from rel 6.40 do the following 1) define the Badi  (SE18). For Abap call test uncheck multiple use and filter boxes 2) Implement the badi (SE19). Add any methods here i

  • ALV GRID OUTPUT PROBLEM.

    here i m sending code for u r reviews. i have two tables: pa0002, zfm_handy i have to display alv grid by using these tables, i m getting output but the fields in the table pa0002(nachn,vorna) r not populated i m getting output for the fields those w

  • Differential Signal to Single Ended Signal Conversion

    Hi, Im facing a problem here. I need an ADC that reads 0-20mA. The signal comes from a signal conditioner that creates a differential signal. However, a NI device with single ended inputs is much cheaper than differential inputs. The signal condition

  • Error while opening Dashboard Builder

    All, I got an unexpected error in InfoView while trying to open 'My dashboards'. Before I have created and saved successfully several Dashboards in that area. The error code displayed is: (EPM 03007) AA2209 and (FWB 00008) Based on this I checked in

  • A Question about Date Format

    Hi All!, I need to store date in the form " MM/dd/yyyy HH:mm:ss a " . I tried DateFormat, SimpleDateFormat, and Calendar classes but could not achieve that format. Can any one suggest how to store date in the above said format? Thanking You in advanc