cancel
Showing results for 
Search instead for 
Did you mean: 

backoffice login with different user group like employee group

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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.

I hope that helps!

Best regards,

Niko

Former Member
0 Kudos

Hi, i am able to login with employeegroup but not able to login with customergroup. Is any way to login in backoffice with customergroup.

Former Member
0 Kudos

Hi Abhishek,

I am having similar kind of requirement. Were you able to login with customerGroup finally ? It seems we are able to login only if the user is of Employee type.

Former Member
0 Kudos

Hi Anjali,

Yes, Because the BackofficeAuthenticationProvider, so the backoffice only accept employee model.

Former Member
0 Kudos

Hi Niko,

I don't see this attribute for an employee in Hybris 5.3.0.8? Is this attribute exist after this release and is it OOB?

Thanks, Manish

Answers (2)

Answers (2)

Former Member
0 Kudos
 <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;
     }
dario_pedol
Discoverer
0 Kudos

Nice. Found this 3 years later and was able to use it. thx

Former Member
0 Kudos

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