Claim for a backend user
Hi everyone!
In this article( www.sitefinity.com/.../single-sign-on-between-sitefinity-and-3rd-party-applications-part-2-using-wif) there is listed a set of sitedfinity claims for SSO.
I wonder if is there a claim for backend using? As far as I understand, it is controlled by IsBackendUser property of a User.
Basically the question is: How I can declare that this specfic user has access to backend in the SWT?
Many thanks!
After some research, I found out that the IsBackendUser field is binded to the BackendUsers role.
Now the problem is that I could not assing a user to some of the "AppRoles" role provider roles(BackendUsers is a part of it). When I create a role("Default" role provider), I can assign a user to it using claims. Why I can't do the same with the roles from "AppRoles"?
Thanks
Hi Vladimir,
Indeed, access to the backend is provided to a user if he's a member of the BackendUsers role.
You should be able to assign users to that role regardless of their provider. This article of our documentation describes how to programatically add users to roles:
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
System.Threading.Tasks;
using
Telerik.Sitefinity.Security;
using
Telerik.Sitefinity.Security.Model;
namespace
Telerik.Sitefinity.Documentation.CodeSnippets.DeepDive.Security.Roles.UsersAndRoles
public
partial
class
RolesApiSnippets
public
static
void
AddUserToRoles(
string
userName, List<
string
> rolesToAdd)
UserManager userManager = UserManager.GetManager();
RoleManager roleManager = RoleManager.GetManager(SecurityManager.ApplicationRolesProviderName);
roleManager.Provider.SuppressSecurityChecks =
true
;
if
(userManager.UserExists(userName))
User user = userManager.GetUser(userName);
foreach
(var roleName
in
rolesToAdd)
if
(roleManager.RoleExists(roleName))
Role role = roleManager.GetRole(roleName);
roleManager.AddUserToRole(user, role);
roleManager.SaveChanges();
roleManager.Provider.SuppressSecurityChecks =
false
;