And again I am asking for the permissions system.... It is outrageous, complicated and just plain annoying how it acts.
I created 3 webservices. Each service creates a role, grants permissions to that role, adds a user and assign the role to the user. We have n many instances of Sitefinity running, that's why I am TRYING to use a script to set these users up.
My first problem was giving permissions to: Blogs, Blogposts, Lists and ListItems. I always got null pointer references when executing the service. But not conistently. And only for these 4 modules. The first instance doing the service works fine but the second (literally identically set up) throws the error. An IIS restart solved the situation but the instance after that again gave me a null pointer. For blogs, I noticed, that as soon as I added a blog into the site, it works again?! Why?
So coding is obviously not the issue here.
Second issue: I gave permissions to view, modify etc for Templates. But as soon as I login as the user, the module for Design is not shown. Why?
And here goes the third:
private void CreatePagesPermissions(string role)
{
string transactionName = "PagePermissions";
PageManager pageMgr = PageManager.GetManager();
string permSet = SecurityConstants.Sets.Pages.SetName;
Permission pagePerm = pageMgr.CreatePermission(
permSet,
pageMgr.GetSecurityRoot(false).Id,
GetRole(role).Id);
pagePerm.GrantActions(
false,
SecurityConstants.Sets.Pages.Create,
SecurityConstants.Sets.Pages.Modify,
SecurityConstants.Sets.Pages.View,
SecurityConstants.Sets.Pages.EditContent,
SecurityConstants.Sets.Pages.CreateChildControls
);
pageMgr.AddPermissionToObject(pageMgr.GetSecurityRoot(false), pagePerm, transactionName);
PageNode page = pageMgr.GetPageNodes().FirstOrDefault(p => p.Title == "Pages");
Permission pageNodePer = pageMgr.CreatePermission(
permSet,
page.Id,
GetRole(role).Id);
pageNodePer.GrantActions(
false,
SecurityConstants.Sets.Pages.Create,
SecurityConstants.Sets.Pages.Modify,
SecurityConstants.Sets.Pages.View,
SecurityConstants.Sets.Pages.EditContent,
SecurityConstants.Sets.Pages.CreateChildControls
);
pageMgr.AddPermissionToObject(page, pageNodePer, transactionName);
TransactionManager.CommitTransaction(transactionName);
pageMgr.SaveChanges();
}
This should normally give the user with this permission access to the pages and ability to edit pages. But it does not. I can view the pages but cannot edit any.
Why?
If you are trying to share login/access across multiple Sitefinty instance you may consider reading this documentation and the out of the box identity server features. www.progress.com/.../administration-configure-single-sign-on-(sso)-between-sitefinity-cms-instances