1

I have restricted the the access for the role "**AdminUser**" in the Access viewer as below.

I have restricted the the access for the role "AdminUser" in the Access viewer as above. Later in the code when I am accessing using the below code

 try
            {
                if (Sitecore.Security.Accounts.User.Exists(@"Sitecore\AdminUser"))
                {
                    isAuthenticated = Sitecore.Security.Authentication.AuthenticationManager.Login(@"Sitecore\AdminUser", true);
                }
            }

It is authenticating the user and I am able to see the user role in the Sitecore.Context.User.Roles as "Admin User"

But when we access the Page it loads well and fine. Is there a way I can stop the user with Role "AdminUser" from accessing the page

Note: I am not accessing the item from Sitecore but as a webpage.

http://domain/Support/Global-editor

  • Does "Admin User" also have the "Administrator" box checked for the user? If so, all security is ignored. – sestocker Apr 11 '17 at 22:54
  • No, It is not an administrator role – Meghan Apr 12 '17 at 1:27
  • My guess is that Sitecore still thinks "Extranet\Anonymous" is the user. Try outputting the current user in your view somewhere to see what user Sitecore is using. – sestocker Apr 12 '17 at 14:04
  • @Meghan were you able to figure this out? – Diego Sep 18 '17 at 2:01
1

I think you are restricting the wrong domain. In your code you are checking against the Sitecore domain but you said you are accessing the page as a webpage which by default uses the Extranet domain. More information on domains can be found here.

0

I agree with @sestocker, May be Sitecore still thinks extranet\anonymous is the user. Debug your code and check what is the context user after your login code. If it does not work I have a auto login code in my blog which also uses Sitecore Ticket manager please try that. This was provided by Sitecore Support.

https://singh-prabhat.blogspot.in/2016/12/sitecore-enable-preview-mode-for.html

0

Can you please try this, Create a new role, let's say "AccessExternalPageName" by default add this rule to all other users and remove this role to Sitecore\AdminUser

Now in you above code check the user role in.

We have tried a type of the same scenario where security access was not captured then added some custom role and identified those checks.

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.