Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capabilities setting to allow user evaluate others but not themself #43

Open
logicexpertise opened this issue Feb 27, 2022 · 1 comment

Comments

@logicexpertise
Copy link

Hi,

There is no combination of mod/ojt:evaluate and mod/ojt:evaluateself that would enable a user to be able to evaluate others but not evaluate themself.

The issue is with the return value of the function ojt_can_evaluate() -

function ojt_can_evaluate($userid, $context) {

Currently the return value of that function is as indicated in the truth table below (note, in the scenario under consideration, $USER->id == $userid):

ojt:evaluate ojt:evaluateself function returns
TRUE TRUE TRUE
TRUE FALSE TRUE
FALSE TRUE TRUE
FALSE FALSE FALSE

The function should return false for the combination in the second line of the above table, ie. TRUE && FALSE should return FALSE.

BTW, the next line, FALSE && TRUE, should also return FALSE, however returning TRUE as the function currently does could be justified on the premise that there may be cases (unlikely) where a user should not be able to evaluate others but be able to evaluate themself.

@danmarsden
Copy link
Member

Hey Olumuyiwa, thanks for the report - feel free to submit a PR and we'll take a look!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants