Bug #1492: Check if the role had been added before.
FEA: ItEr76S04BugFixing
This commit is contained in:
parent
2827e6829f
commit
0512d267f7
1 changed files with 12 additions and 1 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue