1

Sitecore 8.2

I need to login virtual user with name like 'virtualUser2000' (not 'sitecore\virtualUser2000') to sitecore content editor. My code:

    var virtualUser = _authenticationManager.BuildVirtualUser("virtualUser2000", true);
    virtualUser.Roles.Add(Role.FromName("I can edit content in Content Editor"));
    Role scRole =_rolesInRolesManager.GetEveryoneRole(_domainManager.GetDomain("sitecore"));
    virtualUser.Roles.Add(scRole);
    bool isSuccess = _authenticationManager.LoginVirtualUser(virtualUser);
    string ticket = _ticketManager.CreateTicket("virtualUser2000", @"/sitecore/shell");
    if (current != null)
    {
        HttpCookie cookie = new HttpCookie(Sitecore.Web.Authentication.TicketManager.CookieName, ticket)
        {
             HttpOnly = false
        };
        current.Response.AppendCookie(cookie);
    }

My virtual user has access to sitecore content editor but cannot edit content. There is a warning in content editor on all items: enter image description here

I think it happens because 'sitecore\everyone' role does not apply to user. As I found out 'sitecore\everyone' role give access to languages for users. I think I can share access to read/write languages for my "I can edit content in Content Editor" role but I would like to have another solution because I suppose that 'sitecore\everyone' role also responsible for other user permissions.

How can I assign 'sitecore\everyone' role to user?

2

sitecore\everyone is a special role in the Sitecore world as generally it is a special virtual role that gets assigned for every user in the sitecore domain (you have default\everyone and extranet\everyone).

Generally when you provide any kind of access to it you provide it for all the users in the corresponding domain. (that is if we consider the fact you haven't disabled the role for the domain itself which can be checked in the domains.config)

I don't think it is possible to assign this role - as your user should already have it if he is part of the sitecore domain and the role should be assigned to him automatically.

I believe the better solution will be actually creating the Content Reader\Writer custom role (based on your requirements) that you assign to the virtual user or just enroll him in one or several of the existing sitecore domain roles to be able to achieve your business needs.

For more information on the generic roles you can check the official security roles documentation (I am linking the role documentation for 9.0, because I didn't manage to find the 8.2 equivalent but it should should be identical to the 8.2 case as well).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.