@@ -, +, @@ contents of the list. Naturally, the owner can edit permissions. This especially applies to shared lists and public lists. --- installer/data/mysql/atomicupdate/bug18228.perl | 30 +++++++++++++++++++++++++ installer/data/mysql/kohastructure.sql | 5 ++--- 2 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug18228.perl --- a/installer/data/mysql/atomicupdate/bug18228.perl +++ a/installer/data/mysql/atomicupdate/bug18228.perl @@ -0,0 +1,30 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + # Add the new columns + $dbh->do( +q|ALTER TABLE virtualshelves +ADD COLUMN allow_change_from_owner tinyint(1) default 1, +ADD COLUMN allow_change_from_others tinyint(1) default 0| + ); + + # Conversion: + # Since we had no readonly lists, change_from_owner is set to true. + # When adding or delete_other was granted, change_from_others is true. + # Note: In my opinion the best choice; there is no exact match. + $dbh->do( +q|UPDATE virtualshelves +SET allow_change_from_owner = 1, +allow_change_from_others = CASE WHEN allow_add=1 OR allow_delete_other=1 THEN 1 ELSE 0 END| + ); + + # Remove the old columns + $dbh->do( +q|ALTER TABLE virtualshelves +DROP COLUMN allow_add, +DROP COLUMN allow_delete_own, +DROP COLUMN allow_delete_other| + ); + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 18228 - Alter table virtualshelves)\n"; +} --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -2247,9 +2247,8 @@ CREATE TABLE `virtualshelves` ( -- information about lists (or virtual shelves) `sortfield` varchar(16) default 'title', -- the field this list is sorted on `lastmodified` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time the list was last modified `created_on` datetime NOT NULL, -- creation time - `allow_add` tinyint(1) default 0, -- permission for adding entries to list - `allow_delete_own` tinyint(1) default 1, -- permission for deleting entries frm list that you added yourself - `allow_delete_other` tinyint(1) default 0, -- permission for deleting entries from list that another person added + `allow_change_from_owner` tinyint(1) default 1, -- can owner change contents? + `allow_change_from_others` tinyint(1) default 0 -- can others change contents? PRIMARY KEY (`shelfnumber`), CONSTRAINT `virtualshelves_ibfk_1` FOREIGN KEY (`owner`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL -- no cascaded delete, please see HandleDelBorrower in Members.pm ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --