I am trying my first steps with Sitefinity coding by wanting to create a custom role and give this role a set of certain permissions. I therefore used the following instructions:
However, I am not quite sure: Can I use a role's ID as the principalid instead of a singular user?
Also: is there a proper code documentation like MSDN to get the full overview of classes and what the method's parameters are? For example, I do not get why I need to do these lines in the blogspermission Getter:
As in the documentation
In addition, how do I actually execute my code?
If, for example I build a generic function to create roles for me, which requires an input (the role name) and has it's own call of RoleManager.SaveChanges(); - how do I actually trigger Sitefinity to execute this script once, when I use a "main method", that calls the rolecreation function with a specific name?
My code is:
public class Sen_CreateSennRole
public void CreateSenRole(string roleName)
RoleManager roleManager = RoleManager.GetManager();
if (roleManager.GetRoles().Where(r => r.Name == roleName).FirstOrDefault() == null)
// Handle appropriately when the role already exists