aboutsummaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSpp <spp@jorge.gr>2013-09-02 12:12:20 +0200
committerSpp <spp@jorge.gr>2013-09-02 12:12:20 +0200
commitc0dfdeab1c24e9435f7aad37a7c2b50e08b0d37f (patch)
tree6453a65f0433ccc87917ded6c45da1b950ec62e6 /sql
parent2625e78f8089e0bea57bbeffaf77e1b9a2c96a6b (diff)
Core/RBAC: Move learn commands to RBAC (using individual permissions)
Diffstat (limited to 'sql')
-rw-r--r--sql/updates/auth/2013_09_02_11_auth_misc.sql37
-rw-r--r--sql/updates/world/2013_09_02_12_world_command.sql18
2 files changed, 55 insertions, 0 deletions
diff --git a/sql/updates/auth/2013_09_02_11_auth_misc.sql b/sql/updates/auth/2013_09_02_11_auth_misc.sql
new file mode 100644
index 00000000000..04c9b4fb6b4
--- /dev/null
+++ b/sql/updates/auth/2013_09_02_11_auth_misc.sql
@@ -0,0 +1,37 @@
+/* cs_learn.cpp */
+
+SET @id = 417;
+
+-- Add new permissions
+DELETE FROM `rbac_permissions` WHERE `id` BETWEEN @id AND @id+12;
+INSERT INTO `rbac_permissions` (`id`, `name`) VALUES
+(@id+0, 'learn'),
+(@id+1, 'learn all'),
+(@id+2, 'learn all my'),
+(@id+3, 'learn all my class'),
+(@id+4, 'learn all my pettalents'),
+(@id+5, 'learn all my spells'),
+(@id+6, 'learn all my talents'),
+(@id+7, 'learn all gm'),
+(@id+8, 'learn all crafts'),
+(@id+9, 'learn all default'),
+(@id+10, 'learn all lang'),
+(@id+11, 'learn all recipes'),
+(@id+12, 'unlearn');
+
+-- Add permissions to "corresponding Commands Role"
+DELETE FROM `rbac_role_permissions` WHERE `permissionId` BETWEEN @id AND @id+12;
+INSERT INTO `rbac_role_permissions` (`roleId`, `permissionId`) VALUES
+(4, @id+0),
+(4, @id+1),
+(4, @id+2),
+(4, @id+3),
+(4, @id+4),
+(4, @id+5),
+(4, @id+6),
+(4, @id+7),
+(4, @id+8),
+(4, @id+9),
+(4, @id+10),
+(4, @id+11),
+(4, @id+12);
diff --git a/sql/updates/world/2013_09_02_12_world_command.sql b/sql/updates/world/2013_09_02_12_world_command.sql
new file mode 100644
index 00000000000..67f544755e2
--- /dev/null
+++ b/sql/updates/world/2013_09_02_12_world_command.sql
@@ -0,0 +1,18 @@
+/* cs_learn.cpp */
+
+SET @id = 417;
+
+-- Update command table with new RBAC permissions
+UPDATE `command` SET `permission` = @id+0 WHERE `name` = 'learn';
+UPDATE `command` SET `permission` = @id+1 WHERE `name` = 'learn all';
+UPDATE `command` SET `permission` = @id+2 WHERE `name` = 'learn all my';
+UPDATE `command` SET `permission` = @id+3 WHERE `name` = 'learn all my class';
+UPDATE `command` SET `permission` = @id+4 WHERE `name` = 'learn all my pettalents';
+UPDATE `command` SET `permission` = @id+5 WHERE `name` = 'learn all my spells';
+UPDATE `command` SET `permission` = @id+6 WHERE `name` = 'learn all my talents';
+UPDATE `command` SET `permission` = @id+7 WHERE `name` = 'learn all gm';
+UPDATE `command` SET `permission` = @id+8 WHERE `name` = 'learn all crafts';
+UPDATE `command` SET `permission` = @id+9 WHERE `name` = 'learn all default';
+UPDATE `command` SET `permission` = @id+10 WHERE `name` = 'learn all lang';
+UPDATE `command` SET `permission` = @id+11 WHERE `name` = 'learn all recipes';
+UPDATE `command` SET `permission` = @id+12 WHERE `name` = 'unlearn');