on 02-09-2016 12:51 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<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;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, I want to login backoffice with b2b customer user. I think we need to customize BackofficeAuthenticationProvider class. How can I edit? Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.