diff options
author | ElgarL <ElgarL@Palmergames.com> | 2014-04-29 00:22:51 +0100 |
---|---|---|
committer | ElgarL <ElgarL@Palmergames.com> | 2014-04-29 00:22:51 +0100 |
commit | 69faf87866412f2ac48bbedd14eba6833a308bb9 (patch) | |
tree | c44ab836b58972bf027941968e8bc8cdd96397d8 /EssentialsGroupManager/src/org/anjocaido/groupmanager | |
parent | e1631b2af82bf080d70764806ff91aa4ad9ecbcf (diff) | |
download | Essentials-69faf87866412f2ac48bbedd14eba6833a308bb9.tar Essentials-69faf87866412f2ac48bbedd14eba6833a308bb9.tar.gz Essentials-69faf87866412f2ac48bbedd14eba6833a308bb9.tar.lz Essentials-69faf87866412f2ac48bbedd14eba6833a308bb9.tar.xz Essentials-69faf87866412f2ac48bbedd14eba6833a308bb9.zip |
Fix clones forgetting sub groups.
Diffstat (limited to 'EssentialsGroupManager/src/org/anjocaido/groupmanager')
-rw-r--r-- | EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java index 38663ba7d..83e170137 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java @@ -53,6 +53,10 @@ public class User extends DataUnit implements Cloneable { User clone = new User(getDataSource(), this.getLastName()); clone.group = this.group; + + // Clone all subgroups. + clone.subGroups.addAll(this.subGroupListStringCopy()); + for (String perm : this.getPermissionList()) { clone.addPermission(perm); } @@ -72,15 +76,22 @@ public class User extends DataUnit implements Cloneable { if (dataSource.isUserDeclared(this.getUUID())) { return null; } + User clone = dataSource.createUser(this.getUUID()); + if (dataSource.getGroup(group) == null) { clone.setGroup(dataSource.getDefaultGroup()); } else { clone.setGroup(dataSource.getGroup(this.getGroupName())); } + + // Clone all subgroups. + clone.subGroups.addAll(this.subGroupListStringCopy()); + for (String perm : this.getPermissionList()) { clone.addPermission(perm); } + clone.variables = this.variables.clone(this); clone.flagAsChanged(); return clone; @@ -95,6 +106,9 @@ public class User extends DataUnit implements Cloneable { // Set the group silently. clone.setGroup(this.getDataSource().getGroup(this.getGroupName()), false); + // Clone all subgroups. + clone.subGroups.addAll(this.subGroupListStringCopy()); + for (String perm : this.getPermissionList()) { clone.addPermission(perm); } |