Changing permissions using a RepositoryService?

Hi All
I have created a Repository Service using an example from posts in the forums and examples. Which I am trying to do is change the permissions of a text document when it is created in a folder in KM. However nothing is happening when the document is created and the permissions are just inherited from the parent folder.
I must be doing something wrong but I don know what. I have posted my code below and if any one can help me solve this that would be great!
CODE:
  public void received(IEvent event) {
     IResource resource = (IResource)event.getParameter();
     try{
          String rid = resource.getRID().toString();
          if(rid.equals("/new_news/"+resource.getName())){
               ISecurityManager sm = resource.getRepositoryManager().getSecurityManager(resource);
               if(sm != null && sm instanceof IAclSecurityManager){
                    IAclSecurityManager asm = (IAclSecurityManager)sm;
                    IResourceAclManager ram = asm.getAclManager();
                    ram.removeAcl(resource);
                    IResourceAcl ra = ram.createAcl(resource);
                    IUMPrincipal everyone = WPUMFactory.getGroupFactory().getGroup("Everyone");
                    IUMPrincipal owner = WPUMFactory.getUserFactory().getUser(resource.getCreatedBy());
                    IResourceAclEntryList rel = ra.getEntries();
                    IResourceAclEntryListIterator it = rel.iterator();
                    while(it.hasNext()){
                         ra.removeEntry(it.next());
                    ra.addEntry(ram.createAclEntry(everyone, false, ram.getPermission(IAclPermission.ACL_PERMISSION_READ), 0));
                    ra.addEntry(ram.createAclEntry(owner, false, ram.getPermission(IAclPermission.ACL_PERMISSION_FULL_CONTROL), 2));
     }catch(AclPersistenceException e){
          e.printStackTrace();
     }catch(ResourceException e){
          e.printStackTrace();
     }catch(NotAuthorizedException e){
          e.printStackTrace();
     }catch(AclExistsException e){
          e.printStackTrace();
     }catch(UserManagementException e){
          e.printStackTrace();
     }catch(InvalidClassException e){
          e.printStackTrace();
     }catch(AlreadyAssignedToAclException e){
          e.printStackTrace();
     }catch(PermissionNotSupportedException e){
          e.printStackTrace();

I have done the same thing again - creating a file in KM Content and still no joy. I have looked at the log and all that seems to appear is this:
#1.5#00B0D068C0C70062000000000001E6780004051E0B171758#1131526500067#/Applications/Workflow/General#sap.com/irj#com.sap.workflow#Guest#116####8268c33050fe11da81f200b0d068c0c7#Thread[ThreadPool.Worker1,5,SAPEngine_Application_Thread[impl:3]_Group]##0#0#Info#1#com.sap.workflow#Plain###Running task ID WFTaskSchedulerDeadline On Wed Nov 09 08:55:00 GMT 2005#
#1.5#00B0D068C0C7004C000000190001E6780004051E1BB15BFD#1131526778614#/Applications/WebApplications#sap.com/irj#com.sap.engine.services.servlets_jsp.server.runtime.context.ServletContextImpl#PhilWade#574##saptest1.arconw.com_IDP_4849150#PhilWade#d6d0bbd050fe11dacf8500b0d068c0c7#SAPEngine_Application_Thread[impl:3]_3##0#0#Info#1#com.sap.engine.services.servlets_jsp.server.runtime.context.ServletContextImpl#Plain###prt: init#
#1.5#00B0D068C0C70062000000010001E6780004051E1CF8A3DA#1131526800067#/Applications/Workflow/General#sap.com/irj#com.sap.workflow#Guest#116####8268c33050fe11da81f200b0d068c0c7#Thread[ThreadPool.Worker1,5,SAPEngine_Application_Thread[impl:3]_Group]##0#0#Info#1#com.sap.workflow#Plain###Running task ID WFTaskSchedulerDeadline On Wed Nov 09 09:00:00 GMT 2005#
#1.5#00B0D068C0C70056000000210001E6780004051E1D7F23DC#1131526808864#/Applications/KMC/RF#sap.com/irj#com.sapportals.wcm.service.applog.OpenSQLAppLog.logToDatabase(Connection,JDBCAppLogEntry)#PhilWade#574##saptest1.arconw.com_IDP_4849150#PhilWade#d6d0bbd050fe11dacf8500b0d068c0c7#SAPEngine_Application_Thread[impl:3]_16##0#0#Info#1#com.sapportals.wcm.service.applog.OpenSQLAppLog#Java###Level: , AppId: , LogTextId: , PrincipalName: , PrincipalType: , ConstId: , Rid: , Param1: , Param2: , Param3: , Param4: #11#3#com.sapportals.wcm.repository.service.statemanagement.cm.StatemanagementUtilsResource#StateChange#PhilWade#0#1077f126-2d33-2810-96bc-db5d853fb81c#/arco_news/TestFile1.txt#New state:#in progress#null#null#
#1.5#00B0D068C0C70067000000000001E6780004051E1DA0C186#1131526811067#/Applications/WebApplications##com.sap.engine.services.servlets_jsp.server.runtime.context.ServletContextImpl#Guest#116####3bc798b050ff11da8f8a00b0d068c0c7#Thread[Finalizer,8,system]##0#0#Info#1#com.sap.engine.services.servlets_jsp.server.runtime.context.ServletContextImpl#Plain###prt: destroy#
#1.5#00B0D068C0C700580000000B0001E6780004051E1E82E848#1131526825895#/Applications/WebApplications#sap.com/irj#com.sap.engine.services.servlets_jsp.server.runtime.context.ServletContextImpl#PhilWade#574##saptest1.arconw.com_IDP_4849150#PhilWade#d6d0bbd050fe11dacf8500b0d068c0c7#SAPEngine_Application_Thread[impl:3]_5##0#0#Info#1#com.sap.engine.services.servlets_jsp.server.runtime.context.ServletContextImpl#Plain###prt: init#

Similar Messages

  • Help changing permissions using a shell script

    Hey,
    Here's the situation. We have 18 Macs, they're all cloned from a master image and have 2 local accounts - Administrator and Student.
    There are some files on the machines that the student account does not have permission to access, but it's critical that they do. I've written a shell script to change the files so that everyone has permission to read, write and execute them:
    #! /bin/bash
    clear
    sudo chmod ugo+rwx /Library/Audio/Plug-ins/Components/FM8.component
    sudo chmod ugo+rwx /Library/Audio/Plug-ins/VST/FM8.vst
    sudo chmod ugo+rwx /Library/Audio/Plug-ins/VST/FM8\ FX.vst
    sudo chmod ugo+rwx /Library/Application\ Support/Digidesign/Plug-ins/FM8.dpm
    In theory, this means I can just run the script, type the admin password in once and its done (as opposed to typing in the password 4 times and navigating to each file individually.)
    However, this doesn't quite work as planned.
    If I run the script, navigate to the files using the Finder and 'get info' it declares that "Everyone" can "Read & Write". The student account can see the file properly, but the finder just thinks there's nothing there (Size=Zero KB.) Only when I explicitly add the Student account (Add->Student) and set it to "Read & Write" does it start working.
    2 questions really - Why does it do this, and how do I make it work?
    It was my understanding that if everyone could read, write and execute there wouldn't be a problem, regardless of which account tries to access the file?
    Also, if there is a better/easier/faster way of doing the same thing I'm open to suggestions.
    Thanks.

    Thanks Tony,
    Your reply was helpful, I didn't realise you could tie all the paths together and just use one chmod command.
    I actually solved the issues myself this morning (fresh head on after a good nights sleep!)
    It turns out the 'files' I'm trying to modify aren't strictly files at all, they're packages. Using just chmod changes permissions for the top of the package only (hence why I could see the files but they said Zero KB.)
    adding -R to the chmod modified permissions to everything inside the package as well, which has resolved the issue.
    Thanks for the help though!

  • How do I change permissions for the documents and files on my Mac Book Pro after I re-instaalled the HD using a Time Machine back-up?

    I had to re-install the HD on my Mac Book Pro. I used a Time Machine back-up for all the apps and files. Most were restored, However, I cannot unlock a number of them. I tried changing the permissions using Get info but it is not working. I am using the latest version of Moutain Lion OSX.

    Linc:
    Very helpful suggestion and response, Thanks for pointing out that it is a permission issue. I am working through the issue and resolving my problem.

  • After trying to change permissions on my computer so others on my network can access files, my external Hard Drive has a lock on it and I can't access files. I've tried repairing permissions, logging in under another Administrator account, using Terminal

    After trying to change permissions on my computer so others on my network can grab files, my external Hard Drive has a lock on it and I can't access files. I've tried repairing permissions, logging in under another Administrator account, using Terminal to fix the problem, downloaded BatChmod but nothing works… Any other suggestions? I have an Imac running OS10.6.8.

    There is suddenly a lock icon on my external backup drive!
    Custom Permissions

  • HT5654 I have a new computer, Windows 8.  My old laptop died and I used to Sync my iPad and iPhone on that device.  Now I want to update, the new computer states that I do not have permission.  How do i change permissions to this new computer?

    I have a new computer, Windows 8.  My old laptop died and I used to Sync my iPad and iPhone on that device.  Now I want to update, the new desktop computer states that I do not have permission.  How do I change permissions to this new computer?

    Did you authorize it?

  • Unable to change registry key permissions using group policy

    In order to fix a problem with a piece of software not saving it's settings I need to change the permission on a registry key of our client machines.
    I've setup a GPO and in Computer Configuration -> Windows Settings -> Security Settings -> Registry specified the registry key I want to change the permission on, added our staff security group and given the full control over that key.
    The permission are not being changed and when I run rsop I'm getting the following error:
    The policy engine did not attempt to configure the setting.  For more information see %windir%\security\logs\winlogon.log on the target machine.
    I've looked in the winlogon.log file and can see nothing meaningful that relates to this GPO.  I set the logging to be verbose and this doesn't include any additional information.  There appears to be nothing meaningful in the event logs on the
    local machine.
    The OS is Windows 7 SP1
    Anybody shed any light why the policy wouldn't be applying the permissions to the registry key?

    Hi,
    Is this client running Windows 7 64bit? If so, this problem is expected since the Wow6432Node key is only recognizable in 64bit applications.
    Security Client Side extension is a 32 bit application and therefore cannot see the key to change permissions. In this situation, you need to change permission in HKLM/Software/[appname]. For more information, please refer to
    http://support.microsoft.com/kb/896459
    If it is Windows 7 32bit, this is a GPO not apply issue. Please check if the following registry keys exist on the Windows 7 client:
    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\SMART Technologies
    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\SMART Technologies Inc.
    If so, please help collect the following information:
    1.   
    Did this problem only occur on one Windows 7 client or occur on all Windows 7clients?
    2.   
    What’s the Operating System on the DC?
    3.   
    Enable debug logging for the Net Logon service. Reproduce the problem and check if there is any relevant error.
    Enabling debug logging for the Net Logon service
    http://support.microsoft.com/kb/109626
    Regards,
    Bruce

  • How do I change permissions on many files at once?

    Hello!
    I recently had a large hard drive crash, and, long story short, I got all my data back but now have a different user account on a new hard drive.  The permissions on all the files on the computer are fine.
    However, I am a recently graduated film student and use an external drive to edit video.  When I tried to open up Final Cut Pro and work on a project, I was told that the program couldn't work because I didn't have "write" access to my scratch drives.  I changed the permissions on the relevant folders and can now open the application fine, but can't actually edit because ALL the medi files don't give me full read/write access.
    I can change them all one at a time, which requires I enter my password for each one, but this would take a few days of work to complete.
    My question is: how can I add my user account with read/write permission to many files at once?  I've heard this can be done with Terminal, but I'm not sure how. 
    Please give me step-by-step instructions if you can!  I have never used Terminal before!  I am not a techie, but I want to be, and I learn quickly!
    My computer specs:
    15in Macbook Pro, early 2008.
    System 10.5.8

    In the Finder's Get Info window, under permissions, you can click the little gear icon and set the "Apply to encoded items" flag. Then when you change permissions, it will apply to everything underneath the selected folder.

  • I Changed permissions for every enclosed folder in my Library (not Home)

    I wanted to change permissions on a fiie in my root Library (not Home Library) and clicked apply to enclosed items for the entire Library folder. Once I realized what happened (after the fact) I tried to repair permissions but things aren't working right obviously. I have a backup of the Library on my Time Machine drive that is before the snafu.
    Is is possible to restore just this Library folder, and if I restored just this folder using Time Machine would it also restore the permissions as they were before I screwed up.
    I'm backing up the altered Library folder to another drive just to be safe if I do need to restore.
    Always learning,
    Thanks
    Message was edited by: Thor Stevens

    Thor Stevens wrote:
    I wanted to change permissions on a fiie in my root Library (not Home Library) and clicked apply to enclosed items for the entire Library folder. Once I realized what happened (after the fact) I tried to repair permissions but things aren't working right obviously. I have a backup of the Library on my Time Machine drive that is before the snafu.
    Is is possible to restore just this Library folder, and if I restored just this folder using Time Machine would it also restore the permissions as they were before I screwed up.
    no, that's not possible because many of those items are in use while you are booted normally. you need to do a full system restore from TM from before you did this. from your last post you seem to be doing just that. and in the future NEVER ever use "apply to enclosed items" on ANY system created folders. that applies btw to things like your home folder, the library in your home folder, your desktop folder etc. use it only on folders you made yourself. apart from messing up permissions on system files like those in the root library, many system created folders like your home folder have hidden ACLs and using 'apply to enclosed items" propagates those ACLs to everything inside.
    I'm backing up the altered Library folder to another drive just to be safe if I do need to restore.
    Always learning,
    Thanks
    Message was edited by: Thor Stevens

  • Changing permissions of a file in Java

    Hi. I have a servlet which creates files on an AIX server. However, due to the default umask setting, the file is being created with insufficient privileges.
    Is there a way to change the permissions of the file which my servlet is creating - from Java? Specifically, I'd like to change the permissions from 640 to 644 - make world readable.
    Please let me know if this is possible. Some examples would be helpful,
    Thanks.

    the first thing that comes to mind is running a cmd line operation to set the file permissions. use Runtime.exec() and whatever command your operating system supports for permissions. i.e.
    Runtime.getRuntime().exec("chmod 644 " + filename);

  • Unable to change permissions on Hard Disk Drives after rolling back OSX Lion to Snow Leopard

    Are you able to help me?
    I had several problems with permissions and a series of other serious issues after upgrading to Lion, so I did a clean re-install of Snow Leopard 6.4 (from disk), upgraded to 6.8 and still had permissions problems which I have made worse by doing what I thought made sense - giving my administration user access to all hard disks and time machine back-ups. I emphasise "hard disks" because I have an iMac 27" i7 and 250GB Flash Drive provided by Apple where I keep OSX and aplication files.  Thus the Flash Drive (FD) becomes the boot disk, not the Hard Drive.
    Changing preferences on the Apple HD (not FD) and the Time Machine Backup HD to my user name (with administration privaleges) has had the reverse effect of not giving me access to anything other than my OSX system volume on my 250GB Flash drive!  I can only see my files on the hard drives with the root user (which I have used for the first time ever to get that access).  But using the root user does NOT allow me to change permissions of either my Time Machine backup disk or the Hard drive on my iMac !  Why oh why??
    Googling for solutions suggested using iRepair to change permissions but that gives me a "boing" when I try with no effect - at least a "boing" is more feedback that the Apple Finder's response to my attempt to alter permissions in the "info" window!
    Oh! and of course I have unsuccessfuly tried the Disk Utility as well, which does come back with errors - that appear to be "safe to ignore" from Apple Support's website!
    I originally posted a slightly different message to this one to  https://discussions.apple.com/message/16955471#16955471 because it appeared to have similar issues. It appears as if my problem is unfortunately quite unique!
    Godfrey Bridger
    Hamilton, New Zealand

    So the background to this situation:
    1. The user had OS 10.6.8 installed on one volume, while his actual users home folders stored on a second volume, this is fine but can sometimes cause issues during/post upgrade to 10.7
    2. The user upgraded to 10.7 and while his home folders were still being accessed, he no longer had permission to change or modify them.
    3. The user downgraded to 10.6.4 again which broke the link for his users completely.
    4. In an attempt to change the permissions for his information he had the (common) mistake of changing the permissions of his root level of his drive, this did several things, in addition to negatively effecting his OS, it also locked the drive mount points in his (hidden) /Volumes/ folder.
    5. the steps taken to help rectify this issue:
    A. Open Terminal.
    B. TYPE:
    chmod -N /
    chmod 1775 /
    chown root:admin /
    C. Reboot computer
    D. Open Disk Utility.
    E. Repair permissions on the boot volume.
    F. Also the following commands were run on her second drive to allow him access to his stuff again:
    sudo chflags -R nouchg /path to drive/
    chmod -R 775 /path to drive/
    chmod -RN /path to drive/
    chown -R username:staff /path to drive/
    Once the permissions repair is complete the Users can be readded to the System Preferences>Accounts pane and the paths to home directories located in his second drive using the "Advanced Options..." section, but due to the time the permissions repair was going to take this step will be posted tomorrow.
    Also each user will require Terminal commands to make the permissions unique for each user: (this must be done PRIOR to the users being added in System Preferences>Accounts.
    chmod -N /
    chmod 1775 /
    chown root:admin /
    sudo chflags -R nouchg /path to home folder/
    sudo chmod -R 775 /path to home folder/
    sudo chmod -RN /path to home folder/
    sudo chown -R username:staff /path to home folder/
    EE

  • External Hard Drives Changing Permissions to Read Only

    Three of my USB external hard drives have suddenly changed to read only. One of the times I was trying to transfer/back-up the files from one drive that had changed to read only to another external. Suddenly the second drive changed permissions. Then after plugging a third external, that drive changed permissions. They all were working perfectly fine with my computer and I have only been using them on MACS. Any explanations? Could there be something wrong with my USB ports? Is it possible to have a virus of some sort?
    Thank you!

    In disk utility I had a look. I cannot verify or set permission (greyed out). The data coming back from info. How can I change this??
    Name : FUJITSU MHZ2320BH G1 Media
    Type : Disk
    Partition Map Scheme : Master Boot Record
    Disk Identifier : disk2
    Media Name : FUJITSU MHZ2320BH G1 Media
    Media Type : Generic
    Connection Bus : USB
    USB Serial Number : 560A48A291F9
    Device Tree : /PCI0/EHC1@1D,7/@3:0
    Writable : Yes
    Ejectable : Yes
    Mac OS 9 Drivers Installed : No
    Location : External
    Total Capacity : 298,1 GB (320.072.933.376 Bytes)
    S.M.A.R.T. Status : Not Supported
    Disk Number : 2
    Partition Number : 0
    Name : NieuwVolume
    Type : Volume
    Disk Identifier : disk2s1
    Mount Point : /Volumes/NieuwVolume
    File System : Windows NT File System (NTFS)
    Connection Bus : USB
    Device Tree : /PCI0/EHC1@1D,7/@3:1
    Writable : No
    Universal Unique Identifier : C7B58C48-D6BC-4078-9DAE-CB125901A4D6
    Capacity : 298,1 GB (320.070.288.384 Bytes)
    Free Space : 127,1 GB (136.438.530.048 Bytes)
    Used : 171,0 GB (183.631.757.312 Bytes)
    Number of Files : 85.578
    Number of Folders : 0
    Owners Enabled : No
    Can Turn Owners Off : No
    Can Be Formatted : No
    Bootable : No
    Supports Journaling : No
    Journaled : No
    Disk Number : 2
    Partition Number : 1

  • I recently purchased an external hard drive to back up my iMovies. When I try to open the movies on the backup I get a message "you may not have permission to modify that folder" How do I change permissions on the backup?

    I recently purchased an external hard drive to back up my iMovies. When I try to open the movies on the backup I get a message "you may not have permission to modify that folder" How do I change permissions on the backup?

    Hi
    One Must NEVER move or alter any folders named
    • iMovie Event's - or -
    • iMovie Projects - or - alike
    on DESKTOP/FINDER - Ever ! - ONLY Within the iMovie Program ! else all connections are broken and hard to impossibly to mend !
    but rather do as described here under
    Moving Event's and Project's
    Connection - Either connect one Mac in Target mode to the other via FireWire. Or use an external hard disk !
    (Target-Mode - Start one Mac e.g. laptop - BUT keep T-key down during full up-start - Now a FW-symbol is jumping around the screen and it will work as an external hard disk when connected to the other Mac)
    A. The External Hard Disk - MUST BE - Mac OS Extended (hfs) formatted to work for Video. UNIX/DOS/FAT32/Mac OS Exchange works for most other things but not for Video whatever program is used (iMovie or FinalCut)
    B. Should be a FireWire one as USB/USB2 performs badly to me and especially when filling up
    C. Do never Move or Alter any folder named
    • iMovie Event's - or -
    • iMovie Project's
    on DeskTop/Finder - as this will result in iMovie losing connections to them and repair can be anything from hard to impossibly
    D. Moving and Copying must be done within iMovie application and Events to Events - and - Project's to Project's.
    E. Moving Project's to Event's - Do not work for me - I have to export project as a QuickTime movie then Import this into Events.
    Event's window can show two faces
    Like this
    or like this
    from one hard disk Event - You can move it to the other hard disk
    You can not (at least not me) move Event to Project or other way around only
    Event to Event and Project to Project
    Yours Bengt W

  • In I tunes I cant down load a CD.  I get the message "The file couldn't be convereted.  You don't have write access for you ITunes media folder or a folder with in it. To change permissions, ...  When I do this it still dosen't work

    In I tunes I can't down load a CD.  I get the message "The file couldn't be convereted.  You don't have write access for you ITunes media folder or a folder with in it. To change permissions, ...  When I do this it still dosen't work.

    Thanks C F McBlob but I recursively changed the permissions of my Music directory meaning every file and directory beneath it, as well as the directory itself, had the write permissions added.
    I used "chmod -R u+w ./Music" and chmod -R g+w ./Music" to do it.
    Alas, no cigar. :-(

  • I am no longer able to change songs using my headphones

    After updating to iOS 6.0 on my iphone 4S I am no longer able to change songs using the headphone controls and when i double click on the home button it no longer allows me to turn my music on and off without unlocking the screen and going into the music app on the phone.
    Any ideas why this is?  Is it a known bug?

    Start by opening Disk Utility, from Applications > Utilities, then select the internal storage MacIntosh HD, and then Repair Permissions.  You should see some printer libraries noted as having the wrong permissions, that may be part of the problem.
    Be sure you have the latest printer/scanner drivers installed by going to the Canon site and download the latest available.
    You can also try using the Mac OS X built-in scanning software by going to Applications > Image Capture and see if that handles the scanning for you - works great with my Epson scanner.

  • Problem with file permissions using Snow Lepord

    I'm having problems with file Sharing & Permissions using Snow Lepord.
    When I save any new file it only has 'Read & Write' privileges for the user, everyone else is 'read only' or 'no access'.
    We have a Netgear NAS Server which is accessed by other users over the local network and if I change the Privilege to 'read & write' via Get Info and then copy the file from my desktop to ther server it changes the Privilege of the server version to 'no access' we then have to change it again for it to work.
    I also created a new folder on the server and now it says 'no access' and has a no entry icon!
    Any ideas???

    We have issues like this. Have tried running AFP and SMB, now connecting using CIFS. All have the same problem. I can work on one or two files fine, then suddenly, one of the files I just worked on says I don't have permissions. I log off the server and log back on, and then I have permissions to the file. It will work fine for one or two operations, then fails. We just updated to OSX Mavericks and a Windows 2012 server, but have been having this issue for years. My permissions look fine. I can even change permissions, but it won't let me work on the file or move or delete the file or rename the file. Once I log out and log back in, I can do anything I want.

Maybe you are looking for

  • Is there a way to create a site map of all RoboHelp topics in a published project?

    My company uses an external search of our published RoboHelp options (as well as the internal; the external search covers all projects instead of a single one). We're looking to change search programs, but according to our web developer a lot of sear

  • Re:Windows Phone develpement

    Hi I have one WPF application Which is working fine.  So now i want to target that application  to windows 8.1 store and Windows phone 8.1.  i am using visual studio 2013 update 4 for the development. i have few library projects in my wpf application

  • How do I get to see my calender on the computer

    Hi everyone. First time post. How do I get to see my calender on my computer? I have a PC. I do not see where Icloud syncs the calender into the computer. Thanks for the help.

  • IT0009 Bank Account Number

    Hi, How to configure to allow the bank account field (BANKN) in IT0009 accepting letters as bank account? Regards, Jim

  • How to implement microphone detecting??

    Hi all, I've seen some iPhone apps can detect the strength or the direction when user blow to microphone. Dose anyone know where I can find a description about how to implement this feature, I'll deeply appreciate your help.