3
0
Fork 0
mirror of https://github.com/farmOS/farmOS.git synced 2024-02-23 11:37:38 +01:00

Only show developer information if user has edit access to the entity.

This commit is contained in:
Michael Stenta 2022-01-18 22:05:23 -05:00
parent 34ee8f895e
commit b3acd220cc
2 changed files with 6 additions and 2 deletions

View file

@ -21,11 +21,13 @@ function farm_sensor_asset_view_alter(array &$build, AssetInterface $asset, Enti
return;
}
// If the user has permission to edit this sensor asset, display developer
// information.
// Only render developer information in the full view mode.
// Use getOriginalMode() because getMode() is not reliable. The default
// display mode will return "full" unless a "default" display is actually
// saved in config. In either case, the original mode is always "full".
if ($display->getOriginalMode() === 'full') {
if ($asset->access('edit') === TRUE && $display->getOriginalMode() === 'full') {
// Add a Developer information details element with brief description.
$build['api'] = [

View file

@ -25,11 +25,13 @@ function data_stream_data_stream_view_alter(array &$build, DataStreamInterface $
return;
}
// If the user has permission to edit this sensor asset, display developer
// information.
// Only render developer information in the full view mode.
// Use getOriginalMode() because getMode() is not reliable. The default
// display mode will return "full" unless a "default" display is actually
// saved in config. In either case, the original mode is always "full".
if ($display->getOriginalMode() === 'full') {
if ($data_stream->access('edit') === TRUE && $display->getOriginalMode() === 'full') {
// Add a Developer information details element with brief description.
// @todo Include link to updated user guide.