how to restrict the users to change theme other than site admins using features in share point 2010? -


i new sharepoint 2010. restrict users change theme other site admins using feature in sharepoint 2010. tried below code same.

          spsecurity.runwithelevatedprivileges(delegate()              {                  spwebapplication webapp = properties.feature.parent spwebapplication;                    sppolicyrole restrictthemes;                    //we removing applystylesheets permission , applythemeandborder permission passing                  //to policyroles.                  spbasepermissions restrictpermissions = spbasepermissions.applystylesheets | spbasepermissions.applythemeandborder;                    //we not granting permissions                  spbasepermissions grantpermissions = new spbasepermissions();                    restrictthemes = webapp.policyroles["restrict themes"];                    if (restrictthemes == null)                  {                        restrictthemes = webapp.policyroles.add("restrict themes", "restricts themes modified anybody",                                                      grantpermissions,                                                      restrictpermissions);                      webapp.update();                  }                    sppolicy policy = webapp.policies.add("nt authority\\authenticated users", "all authenticated users");                  policy.policyrolebindings.add(restrictthemes);                    webapp.update();  

});

but when try code, isn't allowing site admins. please provide idea or suggestions.

thanks in advance.

why in code? ability apply themes controlled "apply themes , borders" permission. default assigned "design" permission level.

just make sure site's members have proper permissions instead of trying modify permissions everybody. can either modifying permissions of default sharepoint site groups or creating new groups desired permissions.

furthermore, shouldn't assigning permissions directly windows groups. sharepoint doesn't treat windows (or ad) groups same sharepoint groups. can avoid lot of pain creating specific sp groups , assigning ad groups them.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -