aboutsummaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSpp <spp@jorge.gr>2013-09-10 13:48:57 +0200
committerSpp <spp@jorge.gr>2013-09-10 13:48:57 +0200
commitefa194a7ce68cadfffdfbd7b091fb381bd058b9f (patch)
treecf391973fe09caf2d6ac0af6d9cbc1c98847dab3 /sql
parent04b313557ed3fbeec17530bc581459a6226e3da5 (diff)
Core/RBAC: Move npc commands to RBAC (using individual permissions)
Diffstat (limited to 'sql')
-rw-r--r--sql/updates/auth/2013_09_10_06_auth_misc.sql75
-rw-r--r--sql/updates/world/2013_09_10_08_world_command.sql37
2 files changed, 112 insertions, 0 deletions
diff --git a/sql/updates/auth/2013_09_10_06_auth_misc.sql b/sql/updates/auth/2013_09_10_06_auth_misc.sql
new file mode 100644
index 00000000000..e83e5e3cdf4
--- /dev/null
+++ b/sql/updates/auth/2013_09_10_06_auth_misc.sql
@@ -0,0 +1,75 @@
+/* cs_npc.cpp */
+
+SET @id = 570;
+
+-- Add new permissions
+DELETE FROM `rbac_permissions` WHERE `id` BETWEEN @id AND @id+31;
+INSERT INTO `rbac_permissions` (`id`, `name`) VALUES
+(@id+0, 'npc'),
+(@id+1, 'npc add'),
+(@id+2, 'npc add formation'),
+(@id+3, 'npc add item'),
+(@id+4, 'npc add move'),
+(@id+5, 'npc add temp'),
+(@id+6, 'npc add delete'),
+(@id+7, 'npc add delete item'),
+(@id+8, 'npc add follow'),
+(@id+9, 'npc add follow stop'),
+(@id+10, 'npc set'),
+(@id+11, 'npc set allowmove'),
+(@id+12, 'npc set entry'),
+(@id+13, 'npc set factionid'),
+(@id+14, 'npc set flag'),
+(@id+15, 'npc set level'),
+(@id+16, 'npc set link'),
+(@id+17, 'npc set model'),
+(@id+18, 'npc set movetype'),
+(@id+19, 'npc set phase'),
+(@id+20, 'npc set spawndist'),
+(@id+21, 'npc set spawntime'),
+(@id+22, 'npc set data'),
+(@id+23, 'npc info'),
+(@id+24, 'npc near'),
+(@id+25, 'npc move'),
+(@id+26, 'npc playemote'),
+(@id+27, 'npc say'),
+(@id+28, 'npc textemote'),
+(@id+29, 'npc whisper'),
+(@id+30, 'npc yell'),
+(@id+31, 'npc tame');
+
+-- Add permissions to "corresponding Commands Role"
+DELETE FROM `rbac_role_permissions` WHERE `permissionId` BETWEEN @id AND @id+31;
+INSERT INTO `rbac_role_permissions` (`roleId`, `permissionId`) VALUES
+(2, @id+0),
+(3, @id+1),
+(3, @id+2),
+(3, @id+3),
+(3, @id+4),
+(3, @id+5),
+(3, @id+6),
+(3, @id+7),
+(3, @id+8),
+(3, @id+9),
+(3, @id+10),
+(4, @id+11),
+(4, @id+12),
+(3, @id+13),
+(3, @id+14),
+(3, @id+15),
+(3, @id+16),
+(3, @id+17),
+(3, @id+18),
+(3, @id+19),
+(3, @id+20),
+(3, @id+21),
+(4, @id+22),
+(4, @id+23),
+(3, @id+24),
+(3, @id+25),
+(4, @id+26),
+(2, @id+27),
+(2, @id+28),
+(2, @id+29),
+(2, @id+30),
+(3, @id+31);
diff --git a/sql/updates/world/2013_09_10_08_world_command.sql b/sql/updates/world/2013_09_10_08_world_command.sql
new file mode 100644
index 00000000000..5567a5fd248
--- /dev/null
+++ b/sql/updates/world/2013_09_10_08_world_command.sql
@@ -0,0 +1,37 @@
+/* cs_npc.cpp */
+
+SET @id = 570;
+
+-- Update command table with new RBAC permissions
+UPDATE `command` SET `permission` = @id+0 WHERE `name` = 'npc';
+UPDATE `command` SET `permission` = @id+1 WHERE `name` = 'npc add';
+UPDATE `command` SET `permission` = @id+2 WHERE `name` = 'npc add formation';
+UPDATE `command` SET `permission` = @id+3 WHERE `name` = 'npc add item';
+UPDATE `command` SET `permission` = @id+4 WHERE `name` = 'npc add move';
+UPDATE `command` SET `permission` = @id+5 WHERE `name` = 'npc add temp';
+UPDATE `command` SET `permission` = @id+6 WHERE `name` = 'npc add delete';
+UPDATE `command` SET `permission` = @id+7 WHERE `name` = 'npc add delete item';
+UPDATE `command` SET `permission` = @id+8 WHERE `name` = 'npc add follow';
+UPDATE `command` SET `permission` = @id+9 WHERE `name` = 'npc add follow stop';
+UPDATE `command` SET `permission` = @id+10 WHERE `name` = 'npc set';
+UPDATE `command` SET `permission` = @id+11 WHERE `name` = 'npc set allowmove';
+UPDATE `command` SET `permission` = @id+12 WHERE `name` = 'npc set entry';
+UPDATE `command` SET `permission` = @id+13 WHERE `name` = 'npc set factionid';
+UPDATE `command` SET `permission` = @id+14 WHERE `name` = 'npc set flag';
+UPDATE `command` SET `permission` = @id+15 WHERE `name` = 'npc set level';
+UPDATE `command` SET `permission` = @id+16 WHERE `name` = 'npc set link';
+UPDATE `command` SET `permission` = @id+17 WHERE `name` = 'npc set model';
+UPDATE `command` SET `permission` = @id+18 WHERE `name` = 'npc set movetype';
+UPDATE `command` SET `permission` = @id+19 WHERE `name` = 'npc set phase';
+UPDATE `command` SET `permission` = @id+20 WHERE `name` = 'npc set spawndist';
+UPDATE `command` SET `permission` = @id+21 WHERE `name` = 'npc set spawntime';
+UPDATE `command` SET `permission` = @id+22 WHERE `name` = 'npc set data';
+UPDATE `command` SET `permission` = @id+23 WHERE `name` = 'npc info';
+UPDATE `command` SET `permission` = @id+24 WHERE `name` = 'npc near';
+UPDATE `command` SET `permission` = @id+25 WHERE `name` = 'npc move';
+UPDATE `command` SET `permission` = @id+26 WHERE `name` = 'npc playemote';
+UPDATE `command` SET `permission` = @id+27 WHERE `name` = 'npc say';
+UPDATE `command` SET `permission` = @id+28 WHERE `name` = 'npc textemote';
+UPDATE `command` SET `permission` = @id+29 WHERE `name` = 'npc whisper';
+UPDATE `command` SET `permission` = @id+30 WHERE `name` = 'npc yell';
+UPDATE `command` SET `permission` = @id+31 WHERE `name` = 'npc tame';