summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2011-10-28 22:07:43 +0100
committerKHobbits <rob@khobbits.co.uk>2011-10-28 22:07:43 +0100
commit8915c29b31f4809d1fa41afd5a146c6cf27a34b9 (patch)
tree7a1cbba35cdb00eb712bddd023aa47d2f51cffbd
parent6c479fceedcbc4f44c740fa663a411ad09dde8ff (diff)
parent819c8f3aa997ada92fd97d3d22c7e35cdc1f36d4 (diff)
downloadEssentials-8915c29b31f4809d1fa41afd5a146c6cf27a34b9.tar
Essentials-8915c29b31f4809d1fa41afd5a146c6cf27a34b9.tar.gz
Essentials-8915c29b31f4809d1fa41afd5a146c6cf27a34b9.tar.lz
Essentials-8915c29b31f4809d1fa41afd5a146c6cf27a34b9.tar.xz
Essentials-8915c29b31f4809d1fa41afd5a146c6cf27a34b9.zip
Merge remote branch 'remotes/ess/groupmanager' into essmaster
-rw-r--r--EssentialsGroupManager/src/Changelog.txt7
-rw-r--r--EssentialsGroupManager/src/config.yml6
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java4
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java1
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java25
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java29
-rw-r--r--EssentialsGroupManager/src/plugin.yml2
7 files changed, 66 insertions, 8 deletions
diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt
index 6729907b5..9a2eff5f2 100644
--- a/EssentialsGroupManager/src/Changelog.txt
+++ b/EssentialsGroupManager/src/Changelog.txt
@@ -48,4 +48,9 @@ v 1.4:
Enable to allow default Bukkit based permissions to remain enabled, unless directly negated within GroupManager.
- Fixed reading world mirrors from the config.
- Simplified config.yml while retaining backwards compatibility.
- - Added data.save.hours setting to config. This allow control over how long backups are retained. \ No newline at end of file
+ - Added data.save.hours setting to config. This allow control over how long backups are retained.
+v 1.5:
+ - Fixed opOverrides and bukkit_perms_override to read the correct entries.
+ - Better commenting in config.yml
+ - Fixed GM to recognize Superperm child nodes.
+ If you add a node like Towny.admin GM will now correctly report on all child nodes. \ No newline at end of file
diff --git a/EssentialsGroupManager/src/config.yml b/EssentialsGroupManager/src/config.yml
index 25fb5dcd0..6bea3e3e0 100644
--- a/EssentialsGroupManager/src/config.yml
+++ b/EssentialsGroupManager/src/config.yml
@@ -1,9 +1,10 @@
settings:
config:
# With this enabled anyone set as op has full permissions when managing GroupManager
+ # The user will be able to promote players to the same group or even above.
opOverrides: true
- # If enabled any bukkit permissiosn which default to true will be left enabled.
+ # If enabled any plugins bukkit permissions which default to true will be left enabled.
# If the player is op any permissions set to Op will follow suit.
bukkit_perms_override: false
@@ -21,6 +22,9 @@ settings:
mirrors:
# Worlds listed here have their permissions mirrored in their children.
+ # the first element 'world' is the main worlds name
+ # subsequent elements '- world_nether' are worlds which will use the same
+ # user/groups permissions as the parent.
world:
- world_nether
- world2
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java
index ad2945076..521b8c1fb 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java
@@ -52,10 +52,10 @@ public class GMConfiguration {
}
public boolean isOpOverride() {
- return GMconfig.getBoolean("settings.config.bukkit_perms_override", true);
+ return GMconfig.getBoolean("settings.config.opOverrides", true);
}
public boolean isBukkitPermsOverride() {
- return GMconfig.getBoolean("settings.config.opOverrides", true);
+ return GMconfig.getBoolean("settings.config.bukkit_perms_override", false);
}
public Map<String, Object> getMirrorsMap() {
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
index 5ef4fc537..a450b4bee 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
@@ -763,6 +763,7 @@ public class GroupManager extends JavaPlugin {
permissionResult = permissionHandler.checkFullUserPermission(auxUser, args[1]);
if (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) {
sender.sendMessage(ChatColor.RED + "The player doesn't have access to that permission");
+ sender.sendMessage(ChatColor.YELLOW + "SuperPerms reports Node: " + targetPlayer.hasPermission(args[1]));
return false;
}
//PARECE OK
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java
index cb9fdf628..203ac95a9 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java
@@ -7,6 +7,7 @@ package org.anjocaido.groupmanager.permissions;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
import java.util.StringTokenizer;
import org.anjocaido.groupmanager.GroupManager;
import org.anjocaido.groupmanager.data.Group;
@@ -14,6 +15,7 @@ import org.anjocaido.groupmanager.dataholder.WorldDataHolder;
import org.anjocaido.groupmanager.data.User;
import org.anjocaido.groupmanager.utils.PermissionCheckResult;
import org.anjocaido.groupmanager.utils.PermissionCheckResult.Type;
+import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
/**
@@ -93,8 +95,19 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
for (String group : getGroups(userName)) {
for (String perm : ph.getGroup(group).getPermissionList()) {
- if ((!playerPermArray.contains(perm)) && (!playerPermArray.contains("-"+perm)))
+ if ((!playerPermArray.contains(perm)) && (!playerPermArray.contains("-"+perm))) {
playerPermArray.add(perm);
+
+ Map<String, Boolean> children = GroupManager.BukkitPermissions.getChildren(perm);
+ if (children != null) {
+ for (String child : children.keySet()) {
+ if (children.get(child))
+ if ((!playerPermArray.contains(perm)) && (!playerPermArray.contains("-"+perm)))
+ playerPermArray.add(child);
+ }
+ }
+
+ }
}
}
@@ -566,6 +579,9 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|| result.resultType.equals(PermissionCheckResult.Type.FOUND)) {
return true;
}
+ if (Bukkit.getPlayer(user.getName()).hasPermission(permission))
+ return true;
+
return false;
}
@@ -587,7 +603,6 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
PermissionCheckResult resultUser = checkUserOnlyPermission(user, targetPermission);
if (!resultUser.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) {
return resultUser;
-
}
//IT ONLY CHECKS GROUPS PERMISSIONS IF RESULT FOR USER IS NOT FOUND
@@ -603,6 +618,12 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
return resultSubGroup;
}
}
+
+ if (Bukkit.getPlayer(user.getName()).hasPermission(targetPermission)) {
+ result.resultType = PermissionCheckResult.Type.FOUND;
+ result.owner = user;
+ return result;
+ }
//THEN IT RETURNS A NOT FOUND
return result;
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java
index 6a5968c22..9bc38f933 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java
@@ -150,8 +150,19 @@ public class BukkitPermissions {
value = true;
}
- if (value == true)
+ if (value == true){
+ // Set the root permission
attachment.setPermission(permission, value);
+ // fetch and set all children of this permission node
+ Map<String, Boolean> children = permission.getChildren();
+ if (children != null) {
+ for (String child : children.keySet()) {
+ if (children.get(child))
+ attachment.setPermission(child, true);
+ }
+ }
+
+ }
}
// Add any missing permissions for this player (non bukkit plugins)
@@ -171,6 +182,22 @@ public class BukkitPermissions {
player.recalculatePermissions();
}
+ /**
+ * Returns a map of the child permissions as defined by the supplying plugin
+ * null is empty
+ *
+ * @param node
+ * @return
+ */
+ public Map<String, Boolean> getChildren(String node) {
+ for (Permission permission : registeredPermissions) {
+ if (permission.getName() == node) {
+ return permission.getChildren();
+ }
+ }
+ return null;
+ }
+
public List<String> listPerms(Player player) {
List<String> perms = new ArrayList<String>();
diff --git a/EssentialsGroupManager/src/plugin.yml b/EssentialsGroupManager/src/plugin.yml
index 596b4a8d8..b5af09739 100644
--- a/EssentialsGroupManager/src/plugin.yml
+++ b/EssentialsGroupManager/src/plugin.yml
@@ -1,5 +1,5 @@
name: GroupManager
-version: "1.4 (Phoenix)"
+version: "1.5 (Phoenix)"
main: org.anjocaido.groupmanager.GroupManager
website: http://www.anjocaido.info/
description: Provides on-the-fly system for permissions system created by Nijikokun. But all in memory, and with flat-file saving schedule.