I've just checked the preliminary version of the Roles implementation into HEAD so that we can work on it faster (our branch MOODLE_17_ROLES was diverging too much from HEAD).
It's not finished yet, and there's a lot of known bugs and rough edges at this stage, so as a result the dev version ( = HEAD) can be considered very unstable.
So be warned!
It should be improving rapidly from now on, though. Over the next few weeks we'll be looking for a lot of testing, bug reports and collaboration with module maintainers to push out Roles support to all parts of Moodle.
LOL @ W
Gee i hope thats a leg there
/me appologises in advance for a comment that is sure to have offended someone
/me appologises in advance for a comment that is sure to have offended someone
LOL
-- Art
This is great news! Did I hear drum roles? Probably not, that may have just been the sound of all those eyes rolling.
> Did I hear drum roles?
Yes, you did. This is so revolutionary, it deserves to be called Moodle 2.0. Talk about designable, configurable, student-centred education! And deconstruction of all our preconceived notions of teacher/student patterns of interaction and responsibility. My mind is ablaze.
Now on to bug-testing. Sorry to say, I already have three.
Yes, you did. This is so revolutionary, it deserves to be called Moodle 2.0. Talk about designable, configurable, student-centred education! And deconstruction of all our preconceived notions of teacher/student patterns of interaction and responsibility. My mind is ablaze.
Now on to bug-testing. Sorry to say, I already have three.
- role sequencing: breakfast roles should come *before* dinner roles
- heavy bandwidth: could you use less oil and sugar in the recipe?
- differentiation of roles: how do I distinguish between loaves, roles and general pastries?
Don, I would hate to see what happens when you get on a role. Although, I think my students would say that I have been pun pwnd!
uh...ROFL? (roleing on the floor laughing?)
or
Role Role Role your code
Gently to the HEAD
Moodle-ey moodle-ey moodle-ey moodle-ey
Soon the bugs are dead
ouch. can't believe I'm about to post this...
or
Role Role Role your code
Gently to the HEAD
Moodle-ey moodle-ey moodle-ey moodle-ey
Soon the bugs are dead
ouch. can't believe I'm about to post this...
Greg..i think you REALLy need a break fro moodle for a while
No kidding Julian! I probably should have mentioned that I posted during a bout of insomnia last night
(I also reinstalled 1.7 and chased some bugs too...)
Very cool.
Unless you happen to be a Postgres user
Do you want me to commit fixes to lib/db/postgres.php?
Unless you happen to be a Postgres user
Do you want me to commit fixes to lib/db/postgres.php?
I think the necessary patch is below.
After this, the upgrade works for me on Postgres, except that there is a bug in table_column under postgres. The bit where it tries to do
P.S. Moodle coding guidelines specify spaces, not tabs, for indents, but this new code is full of tabs.
After this, the upgrade works for me on Postgres, except that there is a bug in table_column under postgres. The bit where it tries to do
execute_sql('ALTER TABLE '. $CFG->prefix . $table .' RENAME COLUMN '. $field .' TO '. $realfield);Claims that $realfield already exists, even though the previous line of code should have dropped that column. Hoever, the drop statement was not even being attempted. Unfortunately, Petr's update logging code seems to have a bug, and it stopped recording after the first error, so I don't have a record of exactly what happened.
P.S. Moodle coding guidelines specify spaces, not tabs, for indents, but this new code is full of tabs.
Index: mod/forum/lib.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/forum/lib.php,v retrieving revision 1.447 diff -u -r1.447 lib.php --- mod/forum/lib.php 9 Aug 2006 09:18:31 -0000 1.447 +++ mod/forum/lib.php 9 Aug 2006 10:09:15 -0000 @@ -1712,7 +1712,7 @@ } $output .= '<div class="subject">'.format_string($post->subject).'</div>'; - $fullname = fullname($user, has_capability('moodle/site:viewfullnames', $modcontext->id);); + $fullname = fullname($user, has_capability('moodle/site:viewfullnames', $modcontext->id)); $by->name = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&course='.$course->id.'">'.$fullname.'</a>'; $by->date = userdate($post->modified, '', $touser->timezone); $output .= '<div class="author">'.get_string('bynameondate', 'forum', $by).'</div>'; Index: lib/db/postgres7.php =================================================================== RCS file: /cvsroot/moodle/moodle/lib/db/postgres7.php,v retrieving revision 1.195 diff -u -r1.195 postgres7.php --- lib/db/postgres7.php 8 Aug 2006 05:13:12 -0000 1.195 +++ lib/db/postgres7.php 9 Aug 2006 10:09:14 -0000 @@ -1635,26 +1635,26 @@ 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, + roleid integer NOT NULL default 0, + contextid integer NOT NULL default 0, + userid integer NOT NULL default 0, + hidden integer NOT NULL default 0, + timestart integer NOT NULL default 0, + timeend integer NOT NULL default 0, + timemodified integer NOT NULL default 0, + modifierid integer 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, + contextid integer NOT NULL default 0, + roleid integer 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 + timemodified integer NOT NULL default 0, + modifierid integer NOT NULL default 0 );"); modify_database('', "CREATE TABLE prefix_role_deny_grant (
And some more Postgres problems. Logging in does not work until you apply the patch below to lib/accesslib.php. There is some problems with the SQL.
Postres can't cope with using the computed column 'sum' in the HAVING clause, so you need to spell it out again. (Is it a good idea to use a SQL reserved word like 'sum' as a column name?)
And it thinks calling the computed level 'level' is ambiguous, which it is becuase two of the tables being joined have columns called level.
Oh, and I was getting undefined variable warnings, hence the addition of the !empty(...) bits to some if statements.
After this, the quiz module (and creating a course and adding a quiz to it) seems to work for me on Postgres.
Postres can't cope with using the computed column 'sum' in the HAVING clause, so you need to spell it out again. (Is it a good idea to use a SQL reserved word like 'sum' as a column name?)
And it thinks calling the computed level 'level' is ambiguous, which it is becuase two of the tables being joined have columns called level.
Oh, and I was getting undefined variable warnings, hence the addition of the !empty(...) bits to some if statements.
After this, the quiz module (and creating a course and adding a quiz to it) seems to work for me on Postgres.
Index: accesslib.php =================================================================== RCS file: /cvsroot/moodle/moodle/lib/accesslib.php,v retrieving revision 1.4 diff -u -r1.4 accesslib.php --- accesslib.php 9 Aug 2006 05:37:31 -0000 1.4 +++ accesslib.php 9 Aug 2006 11:06:07 -0000 @@ -354,7 +354,7 @@ $siteinstance = get_context_instance(CONTEXT_SYSTEM, SITEID); - $SQL = " SELECT rc.capability, c1.id, (c1.level * 100) AS level, + $SQL = " SELECT rc.capability, c1.id, (c1.level * 100) AS aggregatelevel, SUM(rc.permission) AS sum FROM {$CFG->prefix}role_assignments AS ra @@ -366,12 +366,12 @@ rc.contextid=$siteinstance->id $capsearch GROUP BY - rc.capability,level,c1.id + rc.capability,aggregatelevel,c1.id HAVING - sum != 0 + SUM(rc.permission) != 0 UNION - SELECT rc.capability, c1.id, (c1.level * 100 + c2.level) AS level, + SELECT rc.capability, c1.id, (c1.level * 100 + c2.level) AS aggregatelevel, SUM(rc.permission) AS sum FROM {$CFG->prefix}role_assignments AS ra @@ -385,11 +385,11 @@ $capsearch GROUP BY - rc.capability, level, c1.id + rc.capability, aggregatelevel, c1.id HAVING - sum != 0 + SUM(rc.permission) != 0 ORDER BY - level ASC + aggregatelevel ASC "; // echo "$SQL"; // debug @@ -411,31 +411,31 @@ } /* so up to this point we should have somethign like this - * $capabilities[1] ->level = 1000 + * $capabilities[1] ->aggregatelevel = 1000 ->module = SITEID ->capability = do_anything ->id = 1 (id is the context id) ->sum = 0 - * $capabilities[2] ->level = 1000 + * $capabilities[2] ->aggregatelevel = 1000 ->module = SITEID ->capability = post_messages ->id = 1 ->sum = -9000 - * $capabilittes[3] ->level = 3000 + * $capabilittes[3] ->aggregatelevel = 3000 ->module = course ->capability = view_course_activities ->id = 25 ->sum = 1 - * $capabilittes[4] ->level = 3000 + * $capabilittes[4] ->aggregatelevel = 3000 ->module = course ->capability = view_course_activities ->id = 26 ->sum = 0 (this is another course) - * $capabilities[5] ->level = 3050 + * $capabilities[5] ->aggregatelevel = 3050 ->module = course ->capability = view_course_activities ->id = 25 (override in course 25) @@ -459,7 +459,7 @@ $usercap = array(); // for other user's capabilities foreach ($capabilities as $capability) { - if ($otheruserid) { // we are pulling out other user's capabilities, do not write to session + if (!empty($otheruserid)) { // we are pulling out other user's capabilities, do not write to session if (capability_prohibits($capability->capability, $capability->id, $capability->sum, $usercap)) { $usercap[$capability->id][$capability->capability] = -9000; @@ -489,7 +489,7 @@ // now we don't care about the huge array anymore, we can dispose it. unset($capabilities); - if ($otheruseid) { + if (!empty($otheruseid)) { return $usercap; // return the array } // see array in session to see what it looks like @@ -550,7 +550,7 @@ case CONTEXT_COURSECAT: // Coursecat -> coursecat or site. $coursecat = get_record('course_categories','id',$context->instanceid); - if ($coursecat->parent) { + if (!empty($coursecat->parent)) { // return parent value if exist. $parent = get_context_instance(CONTEXT_COURSECAT, $coursecat->parent); } else {
Did I hear "bug in upgrade logging code"? I am going to work on that more after the 1.6.2 release
Yes, so this morning I was going the upgrade, and in /moodledata/upgradelogs/ I have upg_20060809-1055.html and upg_20060809-1105.html.
The 1105 one ends when the upgrade crashed at a syntax error in the forum module upgrade.
So I fixed that, and resumed the upgrade at about 11:15, and nothing else was logged.
The 1105 one ends when the upgrade crashed at a syntax error in the forum module upgrade.
So I fixed that, and resumed the upgrade at about 11:15, and nothing else was logged.
Thanks Tim! I knew parts were rough but not that rough!
Tabs fixed and your patches checked in (please feel free to check such things straight in if you're in the area anyway!)
Tabs fixed and your patches checked in (please feel free to check such things straight in if you're in the area anyway!)
Wow, that was quick. Thanks.
The tabs would probably be my fault. I installed Eclipse to help me track down some missing brackets and I forgot to change the IDE editing settings from spaces to tabs. Apologies
That's OK, but you might like to change the configuration now. I notice you checked in some more tabs last night.
It is hard to find the right settings in Eclipse, I know from experience that there are some configuration options that appear to do this, but don't actually work in the PHP editor.
In the Window -> Preferences ... dialogue, select PHPeclipse Web Development -> PHP from the tree.
On that page, switch to the 'Typing' tab, and turn on the 'Insert spaces for tab' option there. (You probably also want to check that the 'Remove trailing whitespace on editor save' Option.)
I am pretty sure that is the key setting.
I keep meaning to make a page on Moodledocs, describing the recommeneded Eclipse setup for Moodle development.
It is hard to find the right settings in Eclipse, I know from experience that there are some configuration options that appear to do this, but don't actually work in the PHP editor.
In the Window -> Preferences ... dialogue, select PHPeclipse Web Development -> PHP from the tree.
On that page, switch to the 'Typing' tab, and turn on the 'Insert spaces for tab' option there. (You probably also want to check that the 'Remove trailing whitespace on editor save' Option.)
I am pretty sure that is the key setting.
I keep meaning to make a page on Moodledocs, describing the recommeneded Eclipse setup for Moodle development.
The bit about the remaining upgrade error. This it the fault of the workshop module dp/postgres.php file.
The errors came from this block of upgrade code:
if ($oldversion < 2005041201) { // Mass cleanup of bad upgrade scripts
// Some of those steps might fail, it is normal.
The errors came from this block of upgrade code:
if ($oldversion < 2005041201) { // Mass cleanup of bad upgrade scripts
// Some of those steps might fail, it is normal.
I've started a discussion in the testing forum about Roles, so please direct further feedback about this topic there.
Thanks for the laughs Don and Julian.
(I think the little(?) guy is really happy about the new roles.)
(I think the little(?) guy is really happy about the new roles.)