Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
You can use UIRoleProvider.GetRolesForUser(userName)
the drawback is UIRoleProvider is in EPiServer.Shell.Security, i.e. EPiServer UI package
Thank you! I dont know if the namespace will be a problem, i would assume not and hope it will not :)
Hi I am testing WebApi calls and I Wanted to proble users and their roles.
I can get all roles, and user data but how can I check what roles a user has?
This is a plugin so I can not know what type of role providers a consuming project could have. COuld be Default ones, could be OWIN. Could be something different.
[HttpGet] public IHttpActionResult GetCurrentUserData(string userName) { var virtualRoleRepository = (RolesRepository ?? ServiceLocator.Current.GetInstance<IVirtualRoleRepository>()).GetAllRoles(); var user = EPiServerProfile.Get(userName); //var userRoles = ????? if (user == null) return NotFound(); return Ok(user); }