Skip to content

User: Enable roles combination - refs #5648 #6206

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

christianbeeznest
Copy link
Contributor

No description provided.

$feature = api_detect_feature_context();
$permission = $feature.':edit';

return api_get_permission($permission, $userRoles);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid too many return statements within this method.

return api_get_permission($permission, $userRoles);
}

return $isAllowed;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid too many return statements within this method.

Copy link
Member

@ywarnier ywarnier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small change required for efficiency.

Copy link

codeclimate bot commented Apr 22, 2025

Code Climate has analyzed commit 20b053a and detected 2 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 2

View more on Code Climate.

Copy link
Member

@ywarnier ywarnier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change requested for the display of user roles

$status_options
'keyword_roles',
get_lang('Roles'),
array_combine(api_get_roles(), api_get_roles()),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The select input should show the roles by their translated values.
The translated variables are as follow:

  • ROLE_STUDENT: Learner
  • ROLE_ADMIN: Admin
  • ROLE_SUPER_ADMIN: Super admin
  • ROLE_GLOBAL_ADMIN: Global admin
  • ROLE_TEACHER: Teacher
  • ROLE_HR: Human Resources Manager
  • ROLE_QUESTION_MANAGER: Question manager
  • ROLE_SESSION_MANAGER: Session administrator
  • ROLE_STUDENT_BOSS: Superior (n+1)
  • ROLE_INVITEE: Invitee

Considering we do not have such a "translations" table for roles, I would put that directly (hardcoded) into the api_get_roles() function. We will take care of that in C3.

Just a note for myself: a global admin is the person who initially installed the system (just a detail vs the super admin, which is the person managing all URLs in a multi-URL context).

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

Successfully merging this pull request may close these issues.

2 participants