authorizationfilenet-p8filenet-content-engine

Remove SID from documents - FileNet


We are using FileNet 5.1 and some other team has accidentally deleted a group say 'ABC' from prod. Now the documents who had 'ABC' applied are now having SID on them. We have now created a group with the same name & identified the affected GUIDs. I want to know how can I remove the SID on documents using Java Code? I already have a code to apply the newly created group 'ABC' on the affected documents. Please help


Solution

  • After trying few things I made Java code to remove SID from documents and added newly created group on them. Here is the code:

    Document document = Factory.Document.fetchInstance(<Object Store>, <Document ID>, null);
    AccessPermissionList apl = document.get_Permissions();
    Iterator ite = apl.iterator();
    while (ite.hasNext()) {
        Permission permission = (Permission) ite.next();
        if (permission.get_GranteeName().equals(<SID goes here>)) {
            permission.set_GranteeName("Newly Created Group goes here");
            document.save(RefreshMode.REFRESH);
            break;
        }
    }