if (mp.isExcluded()) {
// Excluded methods takes precedence on any other form of method permission
// remove all existing method permission...
for (Iterator oldPermissionsItr = oldPermissions.iterator(); oldPermissionsItr.hasNext();) {
MethodPermission oldMp = (MethodPermission) oldPermissionsItr.next();
removePermissionedMethod(oldMp, md);
}
// add the excluded
addMethodPermissionForMethod(mp, md);
} else {
if (mp.isUnchecked()) {
// we are trying to add an unchecked method permisison, all role-based
// method permission should be removed since unchecked is now used, if a
// particular method has an excluded method permision, we do not add it
for (Iterator oldPermissionsItr = oldPermissions.iterator(); oldPermissionsItr.hasNext();) {
MethodPermission oldMp = (MethodPermission) oldPermissionsItr.next();
if (!oldMp.isExcluded()) {
removePermissionedMethod(oldMp, md);
addMethodPermissionForMethod(mp, md);
}
}
} else {
// we are trying to add a role based method permission. Check that
// unchecked or excluded method permissions have not been set
// and add it to the current list of role based permission
for (Iterator oldPermissionsItr = oldPermissions.iterator(); oldPermissionsItr.hasNext();) {
MethodPermission oldMp = (MethodPermission) oldPermissionsItr.next();
if (!oldMp.isExcluded()) {
if (!oldMp.isUnchecked()) {
addMethodPermissionForMethod(mp, md);
}
}
}
}