-
Notifications
You must be signed in to change notification settings - Fork 138
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
Accessing User Roles #447
Comments
One way to address this is to add an additional variable to all pages that indicates the roles that the current user has. The current variables can be seen on the page: http://localhost/farm/fd2-example/vars. Currently, the UserID and the UserName are available. A list of UserRoles could also be added. The current variables are generated in all of the .module files. For the above example tab they are defined in: farmdata2_modules/fd2_tabs/fd2_example/fd2_example.module. It should be possible to access the user roles in the .module file and add similar code to add a JavaScript variable accessible in the page. If this is done, the same variable should be added in the .module files for all of the tabs (FD2 Example, FieldKit, BarnKit, FD2 School). In addition, some central way of representing what the different roles are able to do will be important to prevent duplication of that information and effort in each page. |
Another possibility here would be to determine if the configuration information in FarmOS/Drupal is accessible via API. For example, when logged in as an Admin, it is possible to see and configure permissions on the "Modules" page. Under the "Farm API" the "Permissions" can be configures to allow or not allow all of the possible operations for each role (e.g. delete logs, delete own logs, etc). If these can be accessed via API then pages could use this information to configure the UI rather than the role. That would significantly reduce the duplication of information. |
I would like to work on this issue |
When creating and displaying UI elements it will be necessary to know what roles a user has in the FarmOS system (e.g. Admin, Farm Manager, Farm Worker, Farm Viewer). This will allow the UI to display only the controls that the current user has permission to use (e.g. Edit / Delete).
The text was updated successfully, but these errors were encountered: