Folder Permissions: aaApi_ApplyAccessControlList

Hello

I’m new to using Projectwise SDK and would like to change the permissions to a project and its folder structure using the SDK API.

I understand the function to call is aaApi_ApplyAccessControlList.

So far no luck. I believe this is due to my lack of understanding of the required parameters.

I would appreciate if someone could provided a simple example with a brief explanation, or point me in the right direction of some online documentation / resources that could help.

Thanks

Simon

 

  • Yaroslav

    Many thanks for your help. This worked perfectly.

    Regards

    Simon

  • Here is the sample:

    BOOL createParentProject (LPCWSTR name, LONG envId, LONG workflow, LPLONG lpId)
        {
        aaApi_SelectAllStorages ();

        static int const flags = AADMSPROJF_PARENTID | AADMSPROJF_STORAGEID | AADMSPROJF_MANAGERID | AADMSPROJF_NAME | AADMSPROJF_DESC
                                 | AADMSPROJF_MGRTYPE | AADMSPROJF_ENVID | AADMSPROJF_WORKFLOW;
        AADMSPROJITEM src = {flags};
        src.lptstrName = src.lptstrDesc = (LPWSTR)name;
        src.lStorageId = aaApi_GetStorageId (0);
        src.lEnvironmentId = envId;
        src.lWorkflowId = workflow;
        src.lManagerType = AADMS_MGRTYPE_USER;
        src.lManagerId = aaApi_GetCurrentUserId ();

        if (!aaApi_CreateRichProject (&src, NULL, FALSE, TRUE, -1))
            return FALSE;

        ObjectAccessEntry en[] = {{ 0, 0, AADMS_MGRTYPE_ALLUSERS, 0, AADMS_ACCESS_FULL }};
        ObjectAccessSet set[] =
            {
                {AADMSAOTYPE_PROJECT, ARRAY_LENGTH (en), en},
                {AADMSAOTYPE_DOCUMENT, ARRAY_LENGTH (en), en},
                {AADMSAOTYPE_ODS_COMPONENT, ARRAY_LENGTH (en), en},
            };

        if (!aaApi_ApplyAccessControlList (ACL_CARRIER_FOLDER, src.lProjectId, 0, ARRAY_LENGTH (set), set, SUBITEM_ACCESS_UNCHANGED))
            return FALSE;

        *lpId = src.lProjectId;
        return TRUE;

        }