mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
adding role_allow_assign , role_allow_override table and dropping role_deny_grant
This commit is contained in:
parent
c39f126780
commit
f9e2f481df
@ -25,7 +25,8 @@
|
||||
</TABLE>
|
||||
|
||||
<TABLE name="context" />
|
||||
<TABLE name="role_deny_grant" />
|
||||
<TABLE name="role_allow_assign" />
|
||||
<TABLE name="role_allow_override" />
|
||||
<TABLE name="role_assignments">
|
||||
<FIELDS>
|
||||
<FIELD name="enrol" method="NO_CONV" type="varchar" length="20" />
|
||||
|
@ -2101,9 +2101,35 @@ function main_upgrade($oldversion=0) {
|
||||
execute_sql("ALTER TABLE `{$CFG->prefix}role_names` ADD UNIQUE INDEX `roleid-contextid` (`roleid`, `contextid`)",true);
|
||||
}
|
||||
|
||||
if ($version < 2006081600) {
|
||||
if ($oldversion < 2006081600) {
|
||||
execute_sql("ALTER TABLE `{$CFG->prefix}role_capabilities` CHANGE permission permission int(10) NOT NULL default '0'",true);
|
||||
}
|
||||
|
||||
// drop role_deny_grant table, and create 2 new ones
|
||||
if ($oldversion < 2006081700) {
|
||||
execute_sql("DROP TABLE `{$CFG->prefix}role_deny_grant`", true);
|
||||
|
||||
execute_sql("CREATE TABLE {$CFG->prefix}role_allow_assign (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`roleid` int(10) unsigned NOT NULL default '0',
|
||||
`allowassign` int(10) unsigned NOT NULL default '0',
|
||||
KEY `roleid` (`roleid`),
|
||||
KEY `allowassign` (`allowassign`),
|
||||
UNIQUE KEY `roleid-allowassign` (`roleid`, `allowassign`),
|
||||
PRIMARY KEY (`id`)
|
||||
)", true);
|
||||
|
||||
execute_sql("CREATE TABLE {$CFG->prefix}role_allow_override (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`roleid` int(10) unsigned NOT NULL default '0',
|
||||
`allowoverride` int(10) unsigned NOT NULL default '0',
|
||||
KEY `roleid` (`roleid`),
|
||||
KEY `allowoverride` (`allowoverride`),
|
||||
UNIQUE KEY `roleid-allowoverride` (`roleid`, `allowoverride`),
|
||||
PRIMARY KEY (`id`)
|
||||
)", true);
|
||||
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -956,15 +956,25 @@ CREATE TABLE prefix_role_capabilities (
|
||||
PRIMARY KEY (`id`)
|
||||
) TYPE=MYISAM COMMENT ='permission has to be signed, overriding a capability for a particular role in a particular context';
|
||||
|
||||
CREATE TABLE prefix_role_deny_grant (
|
||||
CREATE TABLE prefix_role_allow_assign (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`roleid` int(10) unsigned NOT NULL default '0',
|
||||
`unviewableroleid` int(10) unsigned NOT NULL default '0',
|
||||
`allowassign` int(10) unsigned NOT NULL default '0',
|
||||
KEY `roleid` (`roleid`),
|
||||
KEY `unviewableroleid` (`unviewableroleid`),
|
||||
UNIQUE KEY `roleid-unviewableroleid` (`roleid`, `unviewableroleid`),
|
||||
KEY `allowassign` (`allowassign`),
|
||||
UNIQUE KEY `roleid-allowassign` (`roleid`, `allowassign`),
|
||||
PRIMARY KEY (`id`)
|
||||
) TYPE=MYISAM COMMENT ='this defines what role can touch (assign, override) what role';
|
||||
) TYPE=MYISAM COMMENT ='this defines what role can assign what role';
|
||||
|
||||
CREATE TABLE prefix_role_allow_override (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`roleid` int(10) unsigned NOT NULL default '0',
|
||||
`allowoverride` int(10) unsigned NOT NULL default '0',
|
||||
KEY `roleid` (`roleid`),
|
||||
KEY `allowoverride` (`allowoverride`),
|
||||
UNIQUE KEY `roleid-allowoverride` (`roleid`, `allowoverride`),
|
||||
PRIMARY KEY (`id`)
|
||||
) TYPE=MYISAM COMMENT ='this defines what role can override what role';
|
||||
|
||||
CREATE TABLE prefix_capabilities (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
|
@ -1699,7 +1699,31 @@ function main_upgrade($oldversion=0) {
|
||||
modify_database('',"CREATE UNIQUE INDEX prefix_capabilities_name_idx ON prefix_capabilities (name);");
|
||||
modify_database('',"CREATE INDEX prefix_role_names_roleid_idx ON prefix_role_names (roleid);");
|
||||
modify_database('',"CREATE INDEX prefix_role_names_contextid_idx ON prefix_role_names (contextid);");
|
||||
modify_database('',"CREATE UNIQUE INDEX prefix_role_names_roleidcontextid_idx ON prefix_role_names (roleid, contextid);");
|
||||
modify_database('',"CREATE UNIQUE INDEX prefix_role_names_roleidcontextid_idx ON prefix_role_names (roleid, contextid);");
|
||||
|
||||
if ($oldversion < 2006081700) {
|
||||
modify_database('',"DROP TABLE prefix_role_deny_grant");
|
||||
|
||||
modify_database('',"CREATE TABLE prefix_role_allow_assign (
|
||||
id SERIAL PRIMARY KEY,
|
||||
roleid integer NOT NULL default '0',
|
||||
allowassign integer NOT NULL default '0'
|
||||
);");
|
||||
|
||||
modify_database('',"CREATE INDEX prefix_role_allow_assign_roleid_idx ON prefix_role_allow_assign (roleid);");
|
||||
modify_database('',"CREATE INDEX prefix_role_allow_assign_allowassign_idx ON prefix_role_allow_assign (allowassign);");
|
||||
modify_database('',"CREATE UNIQUE INDEX prefix_role_allow_assign_roleidallowassign_idx ON prefix_role_allow_assign (roleid, allowassign);");
|
||||
|
||||
modify_database('',"CREATE TABLE prefix_role_allow_override (
|
||||
id SERIAL PRIMARY KEY,
|
||||
roleid integer NOT NULL default '0',
|
||||
allowoverride integer NOT NULL default '0'
|
||||
);");
|
||||
|
||||
modify_database('',"CREATE INDEX prefix_role_allow_override_roleid_idx ON prefix_role_allow_override (roleid);");
|
||||
modify_database('',"CREATE INDEX prefix_role_allow_override_allowoverride_idx ON prefix_role_allow_override (allowoverride);");
|
||||
modify_database('',"CREATE UNIQUE INDEX prefix_role_allow_override_roleidallowoverride_idx ON prefix_role_allow_override (roleid, allowoverride);");
|
||||
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
@ -720,14 +720,23 @@ CREATE INDEX prefix_role_capabilities_contextid_idx ON prefix_role_capabilities
|
||||
CREATE INDEX prefix_role_capabilities_modifierid_idx ON prefix_role_capabilities (modifierid);
|
||||
CREATE UNIQUE INDEX prefix_role_capabilities_roleidcontextidcapability_idx ON prefix_role_capabilities (roleid, contextid, capability);
|
||||
|
||||
CREATE TABLE prefix_role_deny_grant (
|
||||
CREATE TABLE prefix_role_allow_assign (
|
||||
id SERIAL PRIMARY KEY,
|
||||
roleid integer NOT NULL default '0',
|
||||
unviewableroleid integer NOT NULL default '0'
|
||||
allowassign integer NOT NULL default '0'
|
||||
);
|
||||
CREATE INDEX prefix_role_deny_grant_roleid_idx ON prefix_role_deny_grant (roleid);
|
||||
CREATE INDEX prefix_role_deny_grant_unviewableroleid_idx ON prefix_role_deny_grant (unviewableroleid);
|
||||
CREATE UNIQUE INDEX prefix_role_deny_grant_roleidunviewableroleid_idx ON prefix_role_deny_grant (roleid, unviewableroleid);
|
||||
CREATE INDEX prefix_role_allow_assign_roleid_idx ON prefix_role_allow_assign (roleid);
|
||||
CREATE INDEX prefix_role_allow_assign_allowassign_idx ON prefix_role_allow_assign (allowassign);
|
||||
CREATE UNIQUE INDEX prefix_role_allow_assign_roleidallowassign_idx ON prefix_role_allow_assign (roleid, allowassign);
|
||||
|
||||
CREATE TABLE prefix_role_allow_override (
|
||||
id SERIAL PRIMARY KEY,
|
||||
roleid integer NOT NULL default '0',
|
||||
allowoverride integer NOT NULL default '0'
|
||||
);
|
||||
CREATE INDEX prefix_role_allow_override_roleid_idx ON prefix_role_allow_override (roleid);
|
||||
CREATE INDEX prefix_role_allow_override_allowoverride_idx ON prefix_role_allow_override (allowoverride);
|
||||
CREATE UNIQUE INDEX prefix_role_allow_override_roleidallowoverride_idx ON prefix_role_allow_override (roleid, allowoverride);
|
||||
|
||||
CREATE TABLE prefix_capabilities (
|
||||
id SERIAL PRIMARY KEY,
|
||||
|
@ -6,7 +6,7 @@
|
||||
// This is compared against the values stored in the database to determine
|
||||
// whether upgrades should be performed (see lib/db/*.php)
|
||||
|
||||
$version = 2006081600; // YYYYMMDD = date
|
||||
$version = 2006081700; // YYYYMMDD = date
|
||||
// XY = increments within a single day
|
||||
|
||||
$release = '1.7 dev'; // Human-friendly version name
|
||||
|
Loading…
x
Reference in New Issue
Block a user