...
Code Block |
---|
@Component
public static class MyListener implements PrivilegeListener {
@Override
public void privilegeChecked(User user, String privilege, boolean hasPrivilege) {
//...do something}
}
}
|
2. From the application context file
...
Code Block |
---|
public static class MyListener implements PrivilegeListener {
@Override
public void privilegeChecked(User user, String privilege, boolean hasPrivilege) {
//...do something}
}
}
|
Registering the listener in the application context file (this could be from a module):
Code Block |
---|
<bean id="myListener" class="org.openmrs.mymodulemypackage.listeners.MyPrivilegeListenerMyListener" /> |
Now our listeners are ready to receive notifications as privileges checks are made.
Example Usage:
The Privilege Helper Module is a good example usage of PrivilegeListeners.