Skip to content
Snippets Groups Projects
Commit b8d8e90d authored by Peter Rotich's avatar Peter Rotich
Browse files

upgrade: Rebase the patches on the new develop-next tip

parent cdb71f2e
No related branches found
No related tags found
No related merge requests found
366ff61fbe023fe840a4a65138320d11
e675900fdac39ec981a8d65fc82907b7
-- drop old permissions from group table
ALTER TABLE `%TABLE_PREFIX%group`
DROP `group_enabled`,
DROP `can_create_tickets`,
DROP `can_edit_tickets`,
DROP `can_post_ticket_reply`,
DROP `can_delete_tickets`,
DROP `can_close_tickets`,
DROP `can_assign_tickets`,
DROP `can_transfer_tickets`,
DROP `can_ban_emails`,
DROP `can_manage_premade`,
DROP `can_manage_faq`,
DROP `can_view_staff_stats`;
-- drop useless updated column
ALTER TABLE `%TABLE_PREFIX%team_member` DROP `updated`;
/**
* @signature c7c828356c88b462ba2e3e1437dca0df
* @version v1.9.6
* @title Add role-based access
*
* This patch adds support for role based access to group and departments
*
*/
CREATE TABLE `%TABLE_PREFIX%role` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`flags` int(10) unsigned NOT NULL DEFAULT '1',
`name` varchar(64) DEFAULT NULL,
`notes` text,
`created` datetime NOT NULL,
`updated` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) DEFAULT CHARSET=utf8;
ALTER TABLE `%TABLE_PREFIX%group_dept_access`
ADD `role_id` INT UNSIGNED NOT NULL DEFAULT '0';
ALTER TABLE `%TABLE_PREFIX%groups`
ADD `role_id` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `group_id` ,
ADD `flags` INT UNSIGNED NOT NULL DEFAULT '1' AFTER `role_id`,
CHANGE `group_name` `name` VARCHAR(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
CHANGE `group_id` `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
ADD INDEX (`role_id`);
RENAME TABLE `%TABLE_PREFIX%groups` TO `%TABLE_PREFIX%group`;
-- department changes
ALTER TABLE `%TABLE_PREFIX%department`
CHANGE `dept_id` `id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT,
CHANGE `dept_signature` `signature` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
CHANGE `dept_name` `name` VARCHAR( 128 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';
-- Finished with patch
UPDATE `%TABLE_PREFIX%config`
SET `schema_signature`='c7c828356c88b462ba2e3e1437dca0df';
<?php
class GroupRoles extends MigrationTask {
var $pmap = array(
'can_create_tickets' => 'ticket.create',
'can_edit_tickets' => 'ticket.edit',
'can_post_ticket_reply' => 'ticket.reply',
'can_delete_tickets' => 'ticket.delete',
'can_close_tickets' => 'ticket.close',
'can_assign_tickets' => 'ticket.assign',
'can_transfer_tickets' => 'ticket.transfer',
'can_ban_emails' => 'emails.banlist',
'can_manage_premade' => 'kb.premade',
'can_manage_faq' => 'kb.faq',
'can_view_staff_stats' => 'stats.agents');
function run($max_time) {
global $cfg;
// Select existing groups and create roles matching the current
// settings
foreach (Group::objects() as $group) {
$ht=array(
'flags=1',
'name' => sprintf('%s %s', $group->getName(),
__('Role')),
'notes' => $group->getName()
);
$perms = array();
foreach (self::$pmap as $k => $v) {
if ($group->{$k})
$perms[] = $v;
}
$ht['permissions'] = $perms;
$role = Role::__create($ht);
$group->role_id = $role->getId();
$group->save();
}
}
}
return 'GroupRoles';
/**
* @version v1.9.6
* @signature 366ff61fbe023fe840a4a65138320d11
* @title Add tasks
* @signature e675900fdac39ec981a8d65fc82907b7
* @title Add support for ticket tasks
*
* This patch adds ability to thread anything and introduces tasks
*
......@@ -112,5 +112,5 @@ UPDATE `%TABLE_PREFIX%config`
-- Set new schema signature
UPDATE `%TABLE_PREFIX%config`
SET `value` = '366ff61fbe023fe840a4a65138320d11'
SET `value` = 'e675900fdac39ec981a8d65fc82907b7'
WHERE `key` = 'schema_signature' AND `namespace` = 'core';
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment