Add admin role to show encrypted customfield values

This commit is contained in:
Ivan Nieto Vivanco 2023-07-11 17:21:32 -06:00
parent 4845a88c68
commit e0df8cc4aa
2 changed files with 4 additions and 4 deletions

View file

@ -101,10 +101,10 @@ class AssetsTransformer
foreach ($asset->model->fieldset->fields as $field) {
if ($field->isFieldDecryptable($asset->{$field->db_column})) {
$decrypted = Helper::gracefulDecrypt($field, $asset->{$field->db_column});
$value = (Gate::allows('superadmin')) ? $decrypted : strtoupper(trans('admin/custom_fields/general.encrypted'));
$value = (Gate::allows('superadmin') || Gate::allows('admin')) ? $decrypted : strtoupper(trans('admin/custom_fields/general.encrypted'));
if ($field->format == 'DATE'){
if (Gate::allows('superadmin')){
if (Gate::allows('superadmin') || Gate::allows('admin')){
$value = Helper::getFormattedDateObject($value, 'date', false);
} else {
$value = strtoupper(trans('admin/custom_fields/general.encrypted'));

View file

@ -460,7 +460,7 @@
@endif
@if ($field->isFieldDecryptable($asset->{$field->db_column_name()} ))
@can('superuser')
@canany(['superuser', 'admin'])
@if (($field->format=='URL') && ($asset->{$field->db_column_name()}!=''))
<a href="{{ Helper::gracefulDecrypt($field, $asset->{$field->db_column_name()}) }}" target="_new">{{ Helper::gracefulDecrypt($field, $asset->{$field->db_column_name()}) }}</a>
@elseif (($field->format=='DATE') && ($asset->{$field->db_column_name()}!=''))
@ -470,7 +470,7 @@
@endif
@else
{{ strtoupper(trans('admin/custom_fields/general.encrypted')) }}
@endcan
@endcanany
@else
@if (($field->format=='BOOLEAN') && ($asset->{$field->db_column_name()}!=''))