Prev Next |
Sitecore V5 introduces the domain concept – roles, users and security assignments are bound to a specific security domain, similar to the Windows security.
The credentials are also validated against specific domain:
// login a user
DomainAccessResult result = Sitecore.Context.Domain.Login(login, password);
if (result.Success)
{
Response.Write(“Welcome”);
}
else
{
Response.Write(“Cannot log in: “ + result.Message);
}
Instead of using generic database access to retrieve the users or roles (groups in Sitecore V4) you should use methods exposed by Domain:
RoleItem[] roles = domain.GetRoles();
RoleItem developers = domain.GetRole(“developers”);
UserItem user = domain.GetUser(“user name”);
Sitecore V4 |
Sitecore V5 |
Sitecore.User, Sitecore.ExtranetUser |
Sitecore.SecurityModel.UserItem |
- |
Sitecore.SecurityModel.RoleItem |
- |
Sitecore.SecurityModel.Domain |
Supplementary reading:
Prev Next