Improve UserMgtAuditLogger
@@ -22,6 +22,7 @@ import org.apache.commons.logging.Log;
import org.wso2.carbon.CarbonConstants;
import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.identity.core.AbstractIdentityUserOperationEventListener;
+import org.wso2.carbon.identity.core.util.IdentityCoreConstants;
import org.wso2.carbon.user.api.Permission;
import org.wso2.carbon.user.core.UserStoreException;
import org.wso2.carbon.user.core.UserStoreManager;
@@ -37,6 +38,17 @@ public class UserMgtAuditLogger extends AbstractIdentityUserOperationEventListen
private static String AUDIT_MESSAGE = "Initiator : %s | Action : %s | Target : %s | Data : { %s } | Result : %s ";
+ @Override
+ public int getExecutionOrderId() {
+
+ int orderId = getOrderId();
+ if (orderId != IdentityCoreConstants.EVENT_LISTENER_ORDER_ID) {
+ return orderId;
+ }
+
+ return 8;
+ }
+
public boolean doPostAddUser(String userName, Object credential, String[] roleList, Map<String, String> claims,
String profile, UserStoreManager userStoreManager) throws UserStoreException {
@@ -149,7 +161,8 @@ public class UserMgtAuditLogger extends AbstractIdentityUserOperationEventListen
}
audit.info(String.format(AUDIT_MESSAGE, getUser(), "Update Users of Role", roleName,
- "Users : " + Arrays.toString(newUsers), SUCCESS));
+ "UsersAddedToRole : " + Arrays.toString(newUsers) + ", UsersDeletedFromRole : " +
+ Arrays.toString(deletedUsers), SUCCESS));
return true;
}
@@ -161,7 +174,8 @@ public class UserMgtAuditLogger extends AbstractIdentityUserOperationEventListen
}
audit.info(String.format(AUDIT_MESSAGE, getUser(), "Update Roles of User", userName,
- "Roles : " + Arrays.toString(newRoles), SUCCESS));
+ "RolesAddedToUser : " + Arrays.toString(newRoles) + ", RolesDeletedFromUser : "
+ + Arrays.toString(deletedRoles), SUCCESS));
return true;
}
