Question

Here is the scenario..

===== scanario 1 ===== 1. Document Library "Gatorate Classic" 2. I have four groups. Group Alpha - Role - Read Group Beta - Role - Edit Group Epselon - Role - Edit Group Gamma - Role - Edit

===== scanario 2 ===== 1. Document Library "Gatorate G2" 2. I have four groups. Group Alpha - Role - Edit Group Beta - Role - Read Group Epselon - Role - Edit Group Gamma - Role - Read


I tried to follow this link but http://www.csharpest.net/?p=74 but i dont think this is my solution. Did anyone had a scenario like this. Same group but different level access.

Was it helpful?

Solution

I Have something where I change the permission level on a Document Library (with Pages) but I have a different need so I built privileges on the pages.

            string groupname = "Group Alpha";
            SPWeb web = getSPWeb();
            web.AllowUnsafeUpdates = true;
            SPGroup grupo = web.Groups[groupname];
            SPFile arq = null;
            SPFolder pasta = web.GetFolder("pages");
            arq = pasta.Files["page1.aspx"];

            if (arq.InDocumentLibrary)
            {
                SPListItem item = arq.Item;
                if (!item.HasUniqueRoleAssignments)
                    item.BreakRoleInheritance(false);
                SPRoleAssignmentCollection roles = item.RoleAssignments;
                while (roles.Count > 0)
                    roles.Remove(0);

                SPRoleAssignment atrib1 = new SPRoleAssignment(web.Groups[groupname] as SPPrincipal);
                atrib1.RoleDefinitionBindings.Add(web.RoleDefinitions.GetByType(SPRoleType.Administrator));
                roles.Add(atrib1);

            }
            web.AllowUnsafeUpdates = false;

Hopes this helps you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top