use of org.wso2.carbon.user.core.listener.UniqueIDUserOperationEventListener in project carbon-identity-framework by wso2.
the class IdentityUserIdResolverListener method doPreDeleteUser.
@Override
public boolean doPreDeleteUser(String userName, UserStoreManager userStoreManager) throws UserStoreException {
if (!isEnable()) {
return true;
}
String userID = ((AbstractUserStoreManager) userStoreManager).getUserIDFromUserName(userName);
if (userID == null) {
return handleUserIDResolveFailure(userName, userStoreManager);
}
// Setting the thread-local to keep userID for doPostDeleteUserWithID listener.
IdentityUtil.threadLocalProperties.get().put(DO_PRE_DELETE_USER_USER_ID, userID);
for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
if (isNotAResolverListener(listener)) {
if (!((UniqueIDUserOperationEventListener) listener).doPreDeleteUserWithID(userID, userStoreManager)) {
return false;
}
}
}
return true;
}
use of org.wso2.carbon.user.core.listener.UniqueIDUserOperationEventListener in project carbon-identity-framework by wso2.
the class IdentityUserIdResolverListener method doPreUpdateUserListOfInternalRole.
@Override
public boolean doPreUpdateUserListOfInternalRole(String roleName, String[] deletedUsers, String[] newUsers, UserStoreManager userStoreManager) throws UserStoreException {
if (!isEnable()) {
return true;
}
String[] deletedUserIDs;
try {
deletedUserIDs = getUserIdsFromUserNames(deletedUsers, (AbstractUserStoreManager) userStoreManager);
} catch (UserStoreException e) {
// supported user store.
if (log.isDebugEnabled()) {
log.debug(e.getMessage(), e);
}
return true;
}
String[] newUserIDs;
try {
newUserIDs = getUserIdsFromUserNames(newUsers, (AbstractUserStoreManager) userStoreManager);
} catch (UserStoreException e) {
// supported user store.
if (log.isDebugEnabled()) {
log.debug(e.getMessage(), e);
}
return true;
}
for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
if (isNotAResolverListener(listener)) {
if (!((UniqueIDUserOperationEventListener) listener).doPreUpdateUserListOfInternalRoleWithID(roleName, deletedUserIDs, newUserIDs, userStoreManager)) {
return false;
}
}
}
return true;
}
Aggregations