If a user doesnt have permission to see an entries attributes - but can see the entry, disable edit and dont attempt to render. Further, if they cant see the objectclasses, dont make additional attributes available

This commit is contained in:
Deon George 2025-05-01 12:12:09 +09:30
parent b9ae269895
commit 5d23cbf0cc
3 changed files with 17 additions and 10 deletions

View File

@ -397,10 +397,10 @@ class HomeController extends Controller
->with('o',$o)
->with('page_actions',collect([
'copy'=>FALSE,
'create'=>TRUE,
'delete'=>TRUE,
'edit'=>TRUE,
'export'=>TRUE,
'create'=>($x=($o->getObjects()->except('entryuuid')->count() > 0)),
'delete'=>$x,
'edit'=>$x,
'export'=>$x,
])),
'import' => $view,

View File

@ -274,7 +274,7 @@ class Entry extends Model
{
$result = collect();
foreach ($this->getObject('objectclass')->values as $oc)
foreach (($this->getObject('objectclass')?->values ?: []) as $oc)
$result = $result->merge(config('server')->schema('objectclasses',$oc)->attributes);
return $result;
@ -439,9 +439,10 @@ class Entry extends Model
*/
public function icon(): string
{
$objectclasses = $this->getObject('objectclass')
->tagValues()
->map(fn($item)=>strtolower($item));
$objectclasses = ($x=$this->getObject('objectclass'))
? $x->tagValues()
->map(fn($item)=>strtolower($item))
: collect();
// Return icon based upon objectClass value
if ($objectclasses->intersect([

View File

@ -88,8 +88,14 @@
<div class="card-header border-bottom-0">
<div class="btn-actions-pane-right">
<div role="group" class="btn-group-sm nav btn-group">
@foreach($langtags->prepend(Entry::TAG_NOTAG)->push('+') as $tag)
<a data-bs-toggle="tab" href="#tab-lang-{{ $tag ?: '_default' }}" class="btn btn-outline-light border-dark-subtle @if(! $loop->index) active @endif @if($loop->last)ndisabled @endif">
@php
$langtags->prepend(Entry::TAG_NOTAG);
if (isset($page_actions) && $page_actions->get('edit'))
$langtags->push('+');
@endphp
@foreach($langtags as $tag)
<a data-bs-toggle="tab" href="#tab-lang-{{ $tag ?: '_default' }}" @class(['btn','btn-outline-light','border-dark-subtle','active'=>!$loop->index])>
@switch($tag)
@case(Entry::TAG_NOTAG)
<i class="fas fa-fw fa-border-none" data-bs-toggle="tooltip" data-bs-custom-class="custom-tooltip" title="@lang('No Lang Tag')"></i>