Bug #1492: Check if the role had been added before.

FEA: ItEr76S04BugFixing
This commit is contained in:
Jacobo Aragunde Pérez 2012-07-10 12:21:35 +02:00
parent 2827e6829f
commit 0512d267f7

View file

@ -194,7 +194,18 @@ public class User extends BaseEntity implements IHumanIdentifiable{
}
public void addProfile(Profile profile) {
profiles.add(profile);
if (!containsProfile(profile)) {
profiles.add(profile);
}
}
private boolean containsProfile(Profile profile) {
for (Profile assignedProfile : profiles) {
if (assignedProfile.getId().equals(profile.getId())) {
return true;
}
}
return false;
}
public void removeProfile(Profile profile) {