ROLES AND PERMISSIONS - FIRST CHECK-IN

=======================================

WARNING:  DEV IS CURRENTLY VERY UNSTABLE.

This is a mega-checkin of the new Roles system.   A lot of changes have
been made in core and modules.

Currently there are a lot of rough edges and known problems.  We are
working hard on these .. .the reason for getting this into HEAD at this
stage is enable us to move faster (our branch was diverging from HEAD
too much).

Please keep an eye on http://docs.moodle.org/en/Roles for current status
and information for developers on how to use the new Roles system.
This commit is contained in:
moodler 2006-08-08 05:13:06 +00:00
parent 394577c3e4
commit bbbf2d4015
139 changed files with 40452 additions and 2001 deletions

555
lib/db/access.php Normal file
View file

@ -0,0 +1,555 @@
<?php
//
// Capability definitions for Moodle core.
//
// The capabilities are loaded into the database table when the module is
// installed or updated. Whenever the capability definitions are updated,
// the module version number should be bumped up.
//
// The system has four possible values for a capability:
// CAP_ALLOW, CAP_PREVENT, CAP_PROHIBIT, and inherit (not set).
//
//
// CAPABILITY NAMING CONVENTION
//
// It is important that capability names are unique. The naming convention
// for capabilities that are specific to modules and blocks is as follows:
// [mod/block]/<component_name>:<capabilityname>
//
// component_name should be the same as the directory name of the mod or block.
//
// Core moodle capabilities are defined thus:
// moodle/<capabilityclass>:<capabilityname>
//
// Examples: mod/forum:viewpost
// block/recent_activity:view
// moodle/site:deleteuser
//
// The variable name for the capability definitions array follows the format
// $<componenttype>_<component_name>_capabilities
//
// For the core capabilities, the variable is $moodle_capabilities.
$moodle_capabilities = array(
'moodle/site:doanything' => array(
'captype' => 'admin',
'contextlevel' => CONTEXT_SYSTEM
),
'moodle/legacy:guest' => array(
'captype' => 'legacy',
'contextlevel' => CONTEXT_SYSTEM
),
'moodle/legacy:student' => array(
'captype' => 'legacy',
'contextlevel' => CONTEXT_SYSTEM
),
'moodle/legacy:teacher' => array(
'captype' => 'legacy',
'contextlevel' => CONTEXT_SYSTEM
),
'moodle/legacy:editingteacher' => array(
'captype' => 'legacy',
'contextlevel' => CONTEXT_SYSTEM
),
'moodle/legacy:coursecreator' => array(
'captype' => 'legacy',
'contextlevel' => CONTEXT_SYSTEM
),
'moodle/legacy:admin' => array(
'captype' => 'legacy',
'contextlevel' => CONTEXT_SYSTEM
),
'moodle/site:config' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_PREVENT,
'teacher' => CAP_PREVENT,
'editingteacher' => CAP_PREVENT,
'coursecreator' => CAP_PREVENT,
'admin' => CAP_ALLOW
)
),
'moodle/site:import' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_PREVENT,
'teacher' => CAP_PREVENT,
'editingteacher' => CAP_PREVENT,
'coursecreator' => CAP_PREVENT,
'admin' => CAP_ALLOW
)
),
'moodle/site:backup' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_PREVENT,
'teacher' => CAP_PREVENT,
'editingteacher' => CAP_PREVENT,
'coursecreator' => CAP_PREVENT,
'admin' => CAP_ALLOW
)
),
'moodle/site:restore' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_PREVENT,
'teacher' => CAP_PREVENT,
'editingteacher' => CAP_PREVENT,
'coursecreator' => CAP_PREVENT,
'admin' => CAP_ALLOW
)
),
'moodle/site:manageblocks' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_PREVENT,
'teacher' => CAP_PREVENT,
'editingteacher' => CAP_PREVENT,
'coursecreator' => CAP_PREVENT,
'admin' => CAP_ALLOW
)
),
'moodle/user:create' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_PREVENT,
'teacher' => CAP_PREVENT,
'editingteacher' => CAP_PREVENT,
'coursecreator' => CAP_PREVENT,
'admin' => CAP_ALLOW
)
),
'moodle/user:delete' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_PREVENT,
'teacher' => CAP_PREVENT,
'editingteacher' => CAP_PREVENT,
'coursecreator' => CAP_PREVENT,
'admin' => CAP_ALLOW
)
),
'moodle/user:update' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_PREVENT,
'teacher' => CAP_PREVENT,
'editingteacher' => CAP_PREVENT,
'coursecreator' => CAP_PREVENT,
'admin' => CAP_ALLOW
)
),
'moodle/user:viewdetails' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'coursecreator' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
),
'moodle/role:assign' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_PREVENT,
'teacher' => CAP_PREVENT,
'editingteacher' => CAP_PREVENT,
'coursecreator' => CAP_PREVENT,
'admin' => CAP_ALLOW
)
),
'moodle/role:manage' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_PREVENT,
'teacher' => CAP_PREVENT,
'editingteacher' => CAP_PREVENT,
'coursecreator' => CAP_PREVENT,
'admin' => CAP_ALLOW
)
),
'moodle/category:create' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSECAT,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_PREVENT,
'teacher' => CAP_PREVENT,
'editingteacher' => CAP_PREVENT,
'coursecreator' => CAP_PREVENT,
'admin' => CAP_ALLOW
)
),
'moodle/category:delete' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSECAT,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_PREVENT,
'teacher' => CAP_PREVENT,
'editingteacher' => CAP_PREVENT,
'coursecreator' => CAP_PREVENT,
'admin' => CAP_ALLOW
)
),
'moodle/category:update' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSECAT,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_PREVENT,
'teacher' => CAP_PREVENT,
'editingteacher' => CAP_PREVENT,
'coursecreator' => CAP_PREVENT,
'admin' => CAP_ALLOW
)
),
'moodle/category:visibility' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSECAT,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_PREVENT,
'teacher' => CAP_PREVENT,
'editingteacher' => CAP_PREVENT,
'coursecreator' => CAP_PREVENT,
'admin' => CAP_ALLOW
)
),
'moodle/course:create' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_PREVENT,
'teacher' => CAP_PREVENT,
'editingteacher' => CAP_PREVENT,
'coursecreator' => CAP_PREVENT,
'admin' => CAP_ALLOW
)
),
'moodle/course:delete' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_PREVENT,
'teacher' => CAP_PREVENT,
'editingteacher' => CAP_PREVENT,
'coursecreator' => CAP_PREVENT,
'admin' => CAP_ALLOW
)
),
'moodle/course:update' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_PREVENT,
'teacher' => CAP_PREVENT,
'editingteacher' => CAP_ALLOW,
'coursecreator' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
),
'moodle/course:view' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'coursecreator' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
),
'moodle/course:visibility' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_PREVENT,
'teacher' => CAP_PREVENT,
'editingteacher' => CAP_PREVENT,
'coursecreator' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
),
'moodle/course:manageactivities' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_PREVENT,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'coursecreator' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
),
'moodle/course:activityvisibility' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_PREVENT,
'teacher' => CAP_PREVENT,
'editingteacher' => CAP_ALLOW,
'coursecreator' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
),
'moodle/course:viewhiddenactivities' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_PREVENT,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'coursecreator' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
),
'moodle/course:viewparticipants' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'coursecreator' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
),
'moodle/course:viewscales' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'coursecreator' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
),
'moodle/course:managescales' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_PREVENT,
'teacher' => CAP_PREVENT,
'editingteacher' => CAP_ALLOW,
'coursecreator' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
),
'moodle/course:managegroups' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_PREVENT,
'teacher' => CAP_PREVENT,
'editingteacher' => CAP_ALLOW,
'coursecreator' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
),
'moodle/blog:view' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'coursecreator' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
),
'moodle/blog:create' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'coursecreator' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
),
'moodle/blog:manageofficialtags' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_PREVENT,
'teacher' => CAP_PREVENT,
'editingteacher' => CAP_PREVENT,
'coursecreator' => CAP_PREVENT,
'admin' => CAP_ALLOW
)
),
'moodle/blog:managepersonaltags' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'coursecreator' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
),
'moodle/blog:manageentries' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_PREVENT,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'coursecreator' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
),
'moodle/calendar:manageownentries' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'coursecreator' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
),
'moodle/calendar:manageentries' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'guest' => CAP_PREVENT,
'student' => CAP_PREVENT,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'coursecreator' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
)
);
?>

View file

@ -2001,6 +2001,75 @@ function main_upgrade($oldversion=0) {
table_column('grade_letter', 'grade_low', 'grade_low', 'decimal(5,2)', '', '', '0.00', 'not null', '');
}
if ($oldversion < 2006080400) {
execute_sql("CREATE TABLE {$CFG->prefix}role (
`id` int(10) NOT NULL auto_increment,
`name` varchar(255) NOT NULL default '',
`description` text NOT NULL default '',
`sortorder` int(10) NOT NULL default '0',
PRIMARY KEY (`id`)
)", true);
execute_sql("CREATE TABLE {$CFG->prefix}context (
`id` int(10) NOT NULL auto_increment,
`level` int(10) NOT NULL default '0',
`instanceid` int(10) NOT NULL default '0',
PRIMARY KEY (`id`)
)", true);
execute_sql("CREATE TABLE {$CFG->prefix}role_assignments (
`id` int(10) NOT NULL auto_increment,
`roleid` int(10) NOT NULL default '0',
`contextid` int(10) NOT NULL default '0',
`userid` int(10) NOT NULL default '0',
`hidden` int(1) NOT NULL default '0',
`timestart` int(10) NOT NULL default '0',
`timeend` int(10) NOT NULL default '0',
`timemodified` int(10) NOT NULL default '0',
`modifierid` int(10) NOT NULL default '0',
`enrol` varchar(20) NOT NULL default '',
`sortorder` int(10) NOT NULL default '0',
PRIMARY KEY (`id`)
)", true);
execute_sql("CREATE TABLE {$CFG->prefix}role_capabilities (
`id` int(10) NOT NULL auto_increment,
`contextid` int(10) NOT NULL default '0',
`roleid` int(10) NOT NULL default '0',
`capability` varchar(255) NOT NULL default '',
`permission` int(10) NOT NULL default '0',
`timemodified` int(10) NOT NULL default '0',
`modifierid` int(10) NOT NULL default '0',
PRIMARY KEY (`id`)
)", true);
execute_sql("CREATE TABLE {$CFG->prefix}role_deny_grant (
`id` int(10) NOT NULL auto_increment,
`roleid` int(10) NOT NULL default '0',
`unviewableroleid` int(10) NOT NULL default '0',
PRIMARY KEY (`id`)
)", true);
execute_sql("CREATE TABLE {$CFG->prefix}capabilities (
`id` int(10) NOT NULL auto_increment,
`name` varchar(150) NOT NULL default '',
`captype` varchar(50) NOT NULL default '',
`contextlevel` int(10) NOT NULL default '0',
`component` varchar(100) NOT NULL default '',
PRIMARY KEY (`id`)
)", true);
execute_sql("CREATE TABLE {$CFG->prefix}role_names (
`id` int(10) NOT NULL auto_increment,
`roleid` int(10) NOT NULL default '0',
`contextid` int(10) NOT NULL default '0',
`text` text NOT NULL default '',
PRIMARY KEY (`id`)
)", true);
}
return $result;
}

View file

@ -899,6 +899,74 @@ CREATE TABLE prefix_blog_tag_instance (
PRIMARY KEY (`id`)
) TYPE=MyISAM COMMENT ='tag instance for blogs.';
###################################
# Roles tables
###################################
CREATE TABLE prefix_role (
`id` int(10) NOT NULL auto_increment,
`name` varchar(255) NOT NULL default '',
`description` text NOT NULL default '',
`sortorder` int(10) NOT NULL default '0',
PRIMARY KEY (`id`)
) TYPE=MyISAM COMMENT ='moodle roles';
CREATE TABLE prefix_context (
`id` int(10) NOT NULL auto_increment,
`level` int(10) NOT NULL default '0',
`instanceid` int(10) NOT NULL default '0',
PRIMARY KEY (`id`)
) TYPE=MyISAM COMMENT ='one of these must be set';
CREATE TABLE prefix_role_assignments (
`id` int(10) NOT NULL auto_increment,
`roleid` int(10) NOT NULL default '0',
`contextid` int(10) NOT NULL default '0',
`userid` int(10) NOT NULL default '0',
`hidden` int(1) NOT NULL default '0',
`timestart` int(10) NOT NULL default '0',
`timeend` int(10) NOT NULL default '0',
`timemodified` int(10) NOT NULL default '0',
`modifierid` int(10) NOT NULL default '0',
`enrol` varchar(20) NOT NULL default '',
`sortorder` int(10) NOT NULL default '0',
PRIMARY KEY (`id`)
) TYPE=MyISAM COMMENT ='assigning roles to different context';
CREATE TABLE prefix_role_capabilities (
`id` int(10) NOT NULL auto_increment,
`contextid` int(10) NOT NULL default '0',
`roleid` int(10) NOT NULL default '0',
`capability` varchar(255) NOT NULL default '',
`permission` int(10) NOT NULL default '0',
`timemodified` int(10) NOT NULL default '0',
`modifierid` int(10) NOT NULL default '0',
PRIMARY KEY (`id`)
) TYPE=MYISAM COMMENT ='overriding a capability for a particular role in a particular context';
CREATE TABLE prefix_role_deny_grant (
`id` int(10) NOT NULL auto_increment,
`roleid` int(10) NOT NULL default '0',
`unviewableroleid` int(10) NOT NULL default '0',
PRIMARY KEY (`id`)
) TYPE=MYISAM COMMENT ='this defines what role can touch (assign, override) what role';
CREATE TABLE prefix_capabilities (
`id` int(10) NOT NULL auto_increment,
`name` varchar(150) NOT NULL default '',
`captype` varchar(50) NOT NULL default '',
`contextlevel` int(10) NOT NULL default '0',
`component` varchar(100) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MYISAM COMMENT ='this defines all capabilities';
CREATE TABLE prefix_role_names (
`id` int(10) NOT NULL auto_increment,
`roleid` int(10) NOT NULL default '0',
`contextid` int(10) NOT NULL default '0',
`text` text NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MYISAM COMMENT ='role names in native strings';
INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('user', 'view', 'user', 'CONCAT(firstname," ",lastname)');
INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('course', 'user report', 'user', 'CONCAT(firstname," ",lastname)');

View file

@ -1617,6 +1617,68 @@ function main_upgrade($oldversion=0) {
//}
}
if ($oldversion < 2006080400) {
modify_database('', "CREATE TABLE prefix_role (
id SERIAL PRIMARY KEY,
name varchar(255) NOT NULL default '',
description text NOT NULL default '',
sortorder integer NOT NULL default '0'
);");
modify_database('', "CREATE TABLE prefix_context (
id SERIAL PRIMARY KEY,
level integer NOT NULL default 0,
instanceid integer NOT NULL default 0
);");
modify_database('', "CREATE TABLE prefix_role_assignments (
id SERIAL PRIMARY KEY,
roleid interger NOT NULL default 0,
contextid interger NOT NULL default 0,
userid interger NOT NULL default 0,
hidden interger NOT NULL default 0,
timestart interger NOT NULL default 0,
timeend interger NOT NULL default 0,
timemodified interger NOT NULL default 0,
modifierid interger NOT NULL default 0,
enrol varchar(20) NOT NULL default '',
sortorder integer NOT NULL default '0'
);");
modify_database('', "CREATE TABLE prefix_role_capabilities (
id SERIAL PRIMARY KEY,
contextid interger NOT NULL default 0,
roleid interger NOT NULL default 0,
capability varchar(255) NOT NULL default '',
permission integer NOT NULL default 0,
timemodified interger NOT NULL default 0,
modifierid interger NOT NULL default 0
);");
modify_database('', "CREATE TABLE prefix_role_deny_grant (
id SERIAL PRIMARY KEY,
roleid integer NOT NULL default '0',
unviewableroleid integer NOT NULL default '0'
);");
modify_database('', "CREATE TABLE prefix_capabilities (
id SERIAL PRIMARY KEY,
name varchar(150) NOT NULL default '',
captype varchar(50) NOT NULL default '',
contextlevel integer NOT NULL default 0,
component varchar(100) NOT NULL default ''
);");
modify_database('', "CREATE TABLE prefix_role_names (
id SERIAL PRIMARY KEY,
roleid integer NOT NULL default 0,
contextid integer NOT NULL default 0,
text text NOT NULL default ''
);");
}
return $result;
}

View file

@ -670,6 +670,68 @@ CREATE TABLE prefix_blog_tag_instance (
CREATE INDEX prefix_bti_entryid_idx ON prefix_blog_tag_instance (entryid);
CREATE INDEX prefix_bti_tagid_idx ON prefix_blog_tag_instance (tagid);
# Roles tables
CREATE TABLE prefix_role (
id SERIAL PRIMARY KEY,
name varchar(255) NOT NULL default '',
description text NOT NULL default '',
sortorder integer NOT NULL default '0'
);
CREATE TABLE prefix_context (
id SERIAL PRIMARY KEY,
level integer NOT NULL default 0,
instanceid integer NOT NULL default 0
);
CREATE TABLE prefix_role_assignments (
id SERIAL PRIMARY KEY,
roleid interger NOT NULL default 0,
contextid interger NOT NULL default 0,
userid interger NOT NULL default 0,
hidden interger NOT NULL default 0,
timestart interger NOT NULL default 0,
timeend interger NOT NULL default 0,
timemodified interger NOT NULL default 0,
modifierid interger NOT NULL default 0,
enrol varchar(20) NOT NULL default '',
sortorder integer NOT NULL default '0'
);
CREATE TABLE prefix_role_capabilities (
id SERIAL PRIMARY KEY,
contextid interger NOT NULL default 0,
roleid interger NOT NULL default 0,
capability varchar(255) NOT NULL default '',
permission integer NOT NULL default 0,
timemodified interger NOT NULL default 0,
modifierid interger NOT NULL default 0
);
CREATE TABLE prefix_role_deny_grant (
id SERIAL PRIMARY KEY,
roleid integer NOT NULL default '0',
unviewableroleid integer NOT NULL default '0'
);
CREATE TABLE prefix_capabilities (
id SERIAL PRIMARY KEY,
name varchar(150) NOT NULL default '',
captype varchar(50) NOT NULL default '',
contextlevel integer NOT NULL default 0,
component varchar(100) NOT NULL default ''
);
CREATE TABLE prefix_role_names (
id SERIAL PRIMARY KEY,
roleid integer NOT NULL default 0,
contextid integer NOT NULL default 0,
text text NOT NULL default ''
);
INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('user', 'view', 'user', 'firstname||\' \'||lastname');
INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('course', 'user report', 'user', 'firstname||\' \'||lastname');
INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('course', 'view', 'course', 'fullname');