Exemplo n.º 1
0
 private static List <WsGroup> GetSecurity(IManSecurity imSec)
 {
     return(GetSecurityGrps(imSec.GroupACLs));
 }
Exemplo n.º 2
0
        private void CopySecurity(IManSecurity templateSecurity, IManSecurity wsSecurity, NameValueCollection wsGroups)
        {
            //Set Security
            wsSecurity.DefaultVisibility = templateSecurity.DefaultVisibility;
            wsSecurity.Inherited = templateSecurity.Inherited;

            if (!templateSecurity.Inherited)
            {
                //Set user ACLs
                foreach (IManUserACL templateUserACL in templateSecurity.UserACLs)
                {
                    wsSecurity.UserACLs.Add(templateUserACL.User.Name, templateUserACL.Right);
                }

                //Set group ACLs
                foreach (IManGroupACL templateGroupACL in templateSecurity.GroupACLs)
                {
                    if (wsGroups != null)
                    {
                        if (wsGroups.Get(templateGroupACL.Group.Name) == null)
                        {
                            //If the group is NOT in the rename groups collectin then add to security
                            wsSecurity.GroupACLs.Add(templateGroupACL.Group.Name, templateGroupACL.Right);
                        }
                        else
                        {
                            //If the group IS in the rename groups collection then
                            //Add new groups to workspace
                            wsSecurity.GroupACLs.Add(wsGroups.Get(templateGroupACL.Group.Name), templateGroupACL.Right);
                        }
                    }
                    else
                    {
                        //If Regroups is null then add existing groups to the new workspace
                        wsSecurity.GroupACLs.Add(templateGroupACL.Group.Name, templateGroupACL.Right);
                    }
                } //foreach group ACL
            } //Inherited check
        }