-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Instructions for editing roles or actions
Sandeep Dubey edited this page May 11, 2021
·
8 revisions
Oppia users are associated with a role. There are multiple roles in the Oppia platform, each role is independent and associated with a set of actions. The user role defines the actions which the user can perform on the Oppia platform.
Editing roles and actions for the platform can be done using the following instructions:
- Open file feconf.py.
- Search for ROLE_ID_GUEST to go to the appropriate place where role Ids are defined.
- Add a constant for the new role string (follow the convention used in defining other roles).
- Go to core/domain/role_services.py.
- If a user can be updated to this role via the admin interface
- Search UPDATABLE_ROLES and add the role Id to the list.
- If a user can be viewed by this role via the admin interface
- Search VIEWABLE_ROLES and add the role Id to the list.
- Search HUMAN_READABLE_ROLES and add the corresponding entry for this role.
- Search _ROLE_ACTIONS and add a new entry for the role.
- key → The role variable from feconf.
- value -> The list of actions allowed for the role.
- If a user can be updated to this role via the admin interface
- Run backend test corresponding to role changes python -m scripts.run_backend_tests --test_target=core.domain.role_services_test.
- Manually test the changes by assigning the new role to a user and through roles and actions visualizer.
- Make sure no user is attached to the role you are going to remove.
- Write a one-off job to audit to check whether a user is associated with such a role.
- Write a one-off job to remove such a role from the users, if it exists. [Talk to admins before planning the removal.]
- Open core/domain/role_services.py in the editor
- Search UPDATABLE_ROLES, VIEWABLE_ROLES, and HUMAN_READABLE_ROLES. Delete the entry corresponding to this role (if any).
- Check _ROLE_ACTIONS and remove all unique actions allocated to the given role.
- Remove the role entry from ROLE_ACTIONS
- Open feconf.py and delete the ROLE_ID* variable corresponding to the given role.
- Run backend test corresponding to role changes python -m scripts.run_backend_tests --test_target=core.domain.role_services_test.
- Manually test the changes
- Roles and actions visualizer should not show the given role and associated unique actions.
- Open core/domain/role_services.py
- Search for “ACTION_”, and add a constant variable corresponding to the new action.
- Search for “ROLE_ACTIONS” and add the new action to the appropriate roles.
- Implement a decorator corresponding to this action in controllers/acl_decorators.py and apply it in necessary places.
- Implement the tests for the new decorator in controllers/acl_decorators_test.py, in order to check the proper functioning of this decorator.
- Open core/domain/role_services.py.
- Search ACTION_ and remove the constant corresponding to this action.
- Remove the action from ROLE_ACTIONS.
- Remove the corresponding decorator of action (and corresponding tests) from controller/action_decorators.py and from wherever it is applied.
- Go to /admin
- Switch to the “Roles” tab
- Fill in the form “Update Role”
- Enter the username of the user
- Select the role.
- Click the “Update role” button
- There are two ways by which you can see the user’s role (by role and by username)
- Go to /admin#roles
- Fill in the form to view roles
- Go to /admin
- Switch to the “Roles” tab
- “Role and actions” card will appear on the right side of the page
- Click the role you’re interested in to check the actions allocated to the selected role.
Have an idea for how to improve the wiki? Please help make our documentation better by following our instructions for contributing to the wiki.
Core documentation
Developing Oppia
- FAQs
- Installing Oppia
- Getting started with the codebase
- Making your first PR
- Learning resources for developers
- Codebase Overview
- Coding Guidelines
- Coding style guide
- Guidelines for creating new files
- How to add a new page
- How to write frontend type definitions
- How to write design docs
- Revert and Regression Policy
- Server errors and solutions
-
Debugging
- If your presubmit checks fail
- If CI checks fail on your PR
- Finding the commit that introduced a bug
- Interpreting GitHub Actions Results
- Debugging Docs
- Debugging datastore locally
- Debugging end-to-end tests
- Debugging backend tests
- Debugging frontend tests
- Debug frontend code
- Debugging custom ESLint check tests
- Debugging custom Pylint check tests
- Debugging Stories
- Guidelines for launching new features
- Guidelines for making an urgent fix (hotfix)
- Lint Checks
- Oppia's code owners and checks to be carried out by developers
- Privacy aware programming
- Backend Type Annotations
- Bytes and string handling in Python 3
- Guidelines for Developers with Write Access to oppia/oppia
- Testing
- Release Process
Developer Reference
- Oppiabot
- Frontend
- Backend
- Translations
- Webpack
- Third-party libraries
- Extension frameworks
- Oppia-ml Extension
- Mobile development
- Mobile device testing
- Performance testing
- Build process
- Team structure
- Triaging Process
- Playbooks
- Wiki
- Past Events