Core/RBAC: Move message commands to RBAC (using individual permissions)

This commit is contained in:
Spp
2013-09-02 13:01:50 +02:00
parent 2d508387e5
commit f68471f142
4 changed files with 69 additions and 13 deletions

View File

@@ -0,0 +1,31 @@
/* cs_message.cpp */
SET @id = 458;
-- Add new permissions
DELETE FROM `rbac_permissions` WHERE `id` BETWEEN @id AND @id+9;
INSERT INTO `rbac_permissions` (`id`, `name`) VALUES
(@id+0, 'announce'),
(@id+1, 'channel'),
(@id+2, 'channel set'),
(@id+3, 'channel set ownership'),
(@id+4, 'gmannounce'),
(@id+5, 'gmnameannounce'),
(@id+6, 'gmnotify'),
(@id+7, 'nameannounce'),
(@id+8, 'notify'),
(@id+9, 'whispers');
-- Add permissions to "corresponding Commands Role"
DELETE FROM `rbac_role_permissions` WHERE `permissionId` BETWEEN @id AND @id+9;
INSERT INTO `rbac_role_permissions` (`roleId`, `permissionId`) VALUES
(2, @id+0),
(4, @id+1),
(4, @id+2),
(4, @id+3),
(2, @id+4),
(2, @id+5),
(2, @id+6),
(2, @id+7),
(2, @id+8),
(2, @id+9);

View File

@@ -0,0 +1,15 @@
/* cs_message.cpp */
SET @id = 458;
-- Update command table with new RBAC permissions
UPDATE `command` SET `permission` = @id+0 WHERE `name` = 'announce';
UPDATE `command` SET `permission` = @id+1 WHERE `name` = 'channel';
UPDATE `command` SET `permission` = @id+2 WHERE `name` = 'channel set';
UPDATE `command` SET `permission` = @id+3 WHERE `name` = 'channel set ownership';
UPDATE `command` SET `permission` = @id+4 WHERE `name` = 'gmannounce';
UPDATE `command` SET `permission` = @id+5 WHERE `name` = 'gmnameannounce';
UPDATE `command` SET `permission` = @id+6 WHERE `name` = 'gmnotify';
UPDATE `command` SET `permission` = @id+7 WHERE `name` = 'nameannounce';
UPDATE `command` SET `permission` = @id+8 WHERE `name` = 'notify';
UPDATE `command` SET `permission` = @id+9 WHERE `name` = 'whispers');