0

I have a SharePoint Library 'World'.In World library,there are multiple country folders and in each country folders we have different cities(subfolders in document lib).

I want to give permission to City group on City Subfolder(in country folder).

Now what I did is I have stopped inheritance of World Library and added to user X to City Group and City group has access on City subfolder that is within Country folder in document library.

Issue is when user X trying to browse City subfolder,access denied is coming.X is part of City Subfolder but not Country folder in Document library.I cheched permissions on City Subfolder,City group has unique permissions on City Subfolder.

I am using below code to give permission on City Subfolder and it is working fine.

function CountryDocumnetsAccess(role, principalid, folderPath) {
    var headers = {
        "Accept": "application/json;odata=verbose",
        "content-Type": "application/json;odata=verbose",
        "X-RequestDigest": jQuery("#__REQUESTDIGEST").val()
    }


   //folder path is Country/City  
   var endPointUrl = _spPageContextInfo.webAbsoluteUrl + "/_api/web/GetFolderByServerRelativeUrl('/sites/gsdcs/World/" + folderPath + "')/ListItemAllFields/";

    var call = $.ajax(
        {
            url: endPointUrl + "breakroleinheritance(true)",
            type: "POST",
            headers: headers,
            dataType: 'json',
            success: function (data) {

                var call = $.ajax(
                    {
                        url: endPointUrl + "roleassignments/addroleassignment(principalid=" + principalid + ",roleDefId=" + role + ")",
                        type: "POST",
                        headers: headers,
                        dataType: 'json',
                        success: function (data) {
                            console.log('Permission Granted to Country Documents successfully ! ' + endPointUrl);
                            CountryLinksAccess(role, principalid, folderPath);
                            if (IsDebug == false)
                                SPClientForms.ClientFormManager.SubmitClientForm(frmID);
                        },
                        error: function (error) {
                            console.log('Permission failed ' + endPointUrl + '  ' + JSON.stringify(error));
                        }
                    });
            },
            error: function (error) {
                console.log(JSON.stringify(error));
            }
        });
}

I am using SharePoint Online.

1
  • Whether you can browse USA folder? Because, user should have view only access to the top folder, so that the user can access sub folders. Commented Oct 27, 2017 at 1:31

2 Answers 2

0

For folder permission follow bellow steps:

1) Create group.
2) Give permission to that group on that library.
3) Stop inheritance on those folder in library which are not accessed by that group.
4) same way for other groups.
5) At last check permission for that group from that folder or library whether some other permission is given or not, If given remove all other permission. 
0

Whether you add the user X to a SharePoint Group and give permission to this SharePoint group?

If so, go to site settings->site collection features->find the “limited-access user permission lockdown mode” feature, make sure this feature is deactivated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.