SHARE
TWEET

Koha Permissions refactoring. Get rid of borrowers.flags.

a guest Jul 11th, 2015 190 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ##Hi there!
  2. ##I want to get rid of borrowers.flags, because computing that binary-array column is very hard and unnecessary.
  3. ##We dont really need that flag-system at all, since all we need are singular permissions for singular tasks.
  4.  
  5.  
  6. diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
  7. index 70effc7..b7a2862 100644
  8. --- a/installer/data/mysql/kohastructure.sql
  9. +++ b/installer/data/mysql/kohastructure.sql
  10. @@ -280,7 +280,6 @@ CREATE TABLE `borrowers` ( -- this table includes information about your patrons
  11.    `ethnotes` varchar(255) default NULL, -- unused in Koha
  12.    `sex` varchar(1) default NULL, -- patron/borrower's gender
  13.    `password` varchar(60) default NULL, -- patron/borrower's encrypted password
  14. -  `flags` int(11) default NULL, -- will include a number associated with the staff member's permissions
  15.    `userid` varchar(75) default NULL, -- patron/borrower's opac and/or staff client log in
  16.    `opacnote` mediumtext, -- a note on the patron/borrower's account that is visible in the OPAC and staff client
  17.    `contactnote` varchar(255) default NULL, -- a note related to the patron/borrower's alternate address
  18. @@ -2323,19 +2322,6 @@ CREATE TABLE `tags_index` ( -- a weighted list of all tags and where they are us
  19.  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  20.  
  21.  --
  22. --- Table structure for table `userflags`
  23. ---
  24. -
  25. -DROP TABLE IF EXISTS `userflags`;
  26. -CREATE TABLE `userflags` (
  27. -  `bit` int(11) NOT NULL default 0,
  28. -  `flag` varchar(30) default NULL,
  29. -  `flagdesc` varchar(255) default NULL,
  30. -  `defaulton` int(11) default NULL,
  31. -  PRIMARY KEY  (`bit`)
  32. -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  33. -
  34. ---
  35.  -- Table structure for table `virtualshelves`
  36.  --
  37.  
  38. @@ -3393,6 +3350,55 @@ CREATE TABLE IF NOT EXISTS `borrower_modifications` (
  39.  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  40.  
  41.  --
  42. +-- Table structure for table permissions
  43. +--
  44. +
  45. +DROP TABLE IF EXISTS permissions;
  46. +CREATE TABLE permissions (
  47. +  permission_id int(11) NOT NULL auto_increment,
  48. +  module varchar(32) NOT NULL,
  49. +  code varchar(64) NOT NULL,
  50. +  description varchar(255) DEFAULT NULL,
  51. +  PRIMARY KEY  (permission_id),
  52. +  UNIQUE KEY (code),
  53. +  CONSTRAINT permissions_to_modules_ibfk1 FOREIGN KEY (module) REFERENCES permission_modules (module)
  54. +    ON DELETE CASCADE ON UPDATE CASCADE
  55. +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  56. +
  57. +--
  58. +-- Table structure for table permission_modules
  59. +--
  60. +
  61. +DROP TABLE IF EXISTS permission_modules;
  62. +CREATE TABLE permission_modules (
  63. +  permission_module_id int(11) NOT NULL auto_increment,
  64. +  module varchar(32) NOT NULL,
  65. +  description varchar(255) DEFAULT NULL,
  66. +  PRIMARY KEY  (permission_module_id),
  67. +  UNIQUE KEY (module)
  68. +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  69. +
  70. +--
  71. +-- Table structure for table borrower_permissions
  72. +--
  73. +
  74. +DROP TABLE IF EXISTS borrower_permissions;
  75. +CREATE TABLE borrower_permissions (
  76. +  borrower_permission_id int(11) NOT NULL auto_increment,
  77. +  borrowernumber int(11) NOT NULL,
  78. +  permission_module_id int(11) NOT NULL,
  79. +  permission_id int(11) NOT NULL,
  80. +  PRIMARY KEY  (borrower_permission_id),
  81. +  UNIQUE KEY (borrowernumber, permission_module_id, permission_id),
  82. +  CONSTRAINT borrower_permissions_ibfk_1 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber)
  83. +    ON DELETE CASCADE ON UPDATE CASCADE,
  84. +  CONSTRAINT borrower_permissions_ibfk_2 FOREIGN KEY (permission_id) REFERENCES permissions (permission_id)
  85. +    ON DELETE CASCADE ON UPDATE CASCADE,
  86. +  CONSTRAINT borrower_permissions_ibfk_3 FOREIGN KEY (permission_module_id) REFERENCES permission_modules (permissi
  87. +    ON DELETE CASCADE ON UPDATE CASCADE
  88. +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  89. +
  90. +--
  91.  -- Table structure for table linktracker
  92.  -- This stores clicks to external links
  93.  --
  94. (END)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top