Unable to correctly interpret output of rolesdebug.php

Unable to correctly interpret output of rolesdebug.php

by Robert Spillner -
Number of replies: 4
Hi folks,

I tried to make an HTML-block on the starting page viewable only for the role "Authentifizierte/r Lehrer/in" (authenticated teacher) by setting "moodle/block:view" to A at the block element context. On the other hand "Authentifizierte/r Nutzer/in" (authenticated user) have P in this block context.

Loggin in as an authenticated teacher I'm still not able to see the HTML-block. I read "How permissions are calculated", used rolesdebug.php and it gives

---------- snip ------
gouser = spil (<name>)
capability = moodle/block:view ("Block sehen")
context = Block502 (Block: HTML)
-
R8 = Authentifizierte/r Lehrer/in
R7 = Authentifizierte/r Nutzer/in
Kernsystem Startseite HTML
R8(A), R7(A) -
-
-
-
-
R8(A), R7(P) -
-

Calculated permission = P
Can do anything = false
Can do this = false
---------- snip ------

Doesn't that contradict the article mentioned above?

What am I missing? How can I enable this Block-Element for teachers only without disclosing it to authenticated users? Thank you!
Average of ratings: -
In reply to Robert Spillner

Re: Unable to correctly interpret output of rolesdebug.php

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
The German translation you link to is wrong in one detail (what happens when you get to a cell containing the same number of As and Ps). The English translation How_permissions_are_calculated has been correct for some time. (But, when I made a prettier version of rolesdebug.php as part of the main roles interface in Moodle 2.0, I flipped the table round another way.)
In reply to Tim Hunt

Re: Unable to correctly interpret output of rolesdebug.php

by Robert Spillner -

Hi Tim,

sorry, changed my originally post, because I think I'm slowly getting it:

Translating the table to the format of the English doc leads to this:


Role
3
2
Role-Def
3 Block




2 Frontpage




1 System
R7, R8
P, A

A, A


Since P, A is in the last row the script tries to jump to the next row. So it doesn't pass any cell with an unbalanced number of As and Ps and outputs P.

I must admit I don't really see how this makes sense in practice. Wouldn't one expect that the System-context is the last "fallback" that is never skipped especially when it gives a clear answer?

This forces me to explicitly assign roles for the Block (or Frontpage)-context which --- from the users view --- are already assigned at the system context only to make the intended fallback to the System-context work:


Role
3
2
Role-Def
3 Block
R8
P, A


2 Frontpage




1 System
R7, R8


A, A

Is there a nicer solution? Thanks.
In reply to Robert Spillner

Re: Unable to correctly interpret output of rolesdebug.php

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I must admit to only looking at the diagrams, not carefully reading the text.

But now that I check: Under the heading "The calculation", point 2, third bullet point. "If the number of Prevents and Allows is equal, jump down to the start of the next row with role assignments, and repeat this step 2." So the text is right.

So, in the orientation of the rolesdebug.php script, once it fids A + P = 0 in the Kernsystem column, it ignores everything higher up the column.


I only discovered this detail of the algorithm last October (by reading the code), and it surprised me at the time. When I did discover it, I thought it was irrelevant, because I could not think of a realistic situation where it would make a difference.

What exactly is your situation? It seems to be a HTML block on the site Front page, but my German is not good enough to work out the role names. It would be great if you could explain what you are trying to achieve. Thanks.
In reply to Tim Hunt

Re: Unable to correctly interpret output of rolesdebug.php

by Robert Spillner -
It is a HTML block-Element on the Front page of the site.

I tried to make an HTML-block on the front page viewable only for the role R8 by setting "moodle/block:view" to A at the block element context and P for R7 (authenticated user).