Skip to Content
author's profile photo Former Member
Former Member

backoffice login with different user group like employee group

HI , We have customized backoffice extension.As default behavior, We can login to backoffice only through the user of admin group but We have requirement like login to backoffice through the user of other group .Please guide how to allow login access to for different User groups may be employee groups.

Thanks in advanced, Jasapriya

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Feb 09, 2016 at 01:00 PM

    Hi Jasapriya!

    In hMC, you can easily allow other users to be able to log into the backoffice by setting the corresponding attribute.

    You can also do this for your user groups as this example was simply for an employee.

    Go to:
     hMC > User > Employee/Customer
    

    Open the desired user and go to its editor area and the Administration tab. In here, scroll down and you should see the Disable backoffice Login: and the corersponding radio buttons. Simply ensure that this is set to No and your user will have access to backoffice.

    alt text I hope that helps!

    Best regards,

    Niko


    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 13, 2018 at 07:51 AM

    Hi, I want to login backoffice with b2b customer user. I think we need to customize BackofficeAuthenticationProvider class. How can I edit? Thanks.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 16, 2018 at 12:48 PM
     <alias name="myBackofficeAuthenticationProvider" alias="backofficeAuthenticationProvider"/>
     <bean id="myBackofficeAuthenticationProvider"
           class="net.xx.yy.backoffice.spring.security.myBackofficeAuthenticationProvider" parent="platformBackofficeAuthenticationProvider">
         <property name="allowedUserGroups">
             <list>
                 <value>Admingroup</value>
                 <value>yourGroup</value>
             </list>
         </property>
     </bean>
    
     public class myBackofficeAuthenticationProvider extends BackofficeAuthenticationProvider {
     
        private Collection<String> allowedUserGroups;
     ....
     
         @Override
         protected void checkBackofficeAccess(EmployeeModel employee) throws DisabledException {
             super.checkBackofficeAccess(employee);
             checkForAllowedGroups(employee);
         }
     
     ....
     
         protected void checkForAllowedGroups(UserModel user) {
             if (CollectionUtils.isNotEmpty(this.allowedUserGroups)) {
                 for(PrincipalGroupModel group:user.getAllGroups()){
                     if (this.allowedUserGroups.contains(group.getUid().toLowerCase())) {
                         return;
                     }
                 }
                 LOG.warn("Login attempt rejected (group restriction) for user : {}",user);
                 throw new DisabledException("Login attempt rejected (group restriction)");
             }
         }
     
     ....
     
         public void setAllowedUserGroups(Collection<String> allowedUserGroups) {
             this.allowedUserGroups =allowedUserGroups != null?allowedUserGroups.stream().map(String::toLowerCase).collect(Collectors.toSet()):Collections.EMPTY_SET;
         }
    
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.