Eutanasio Posted April 1, 2021 Share Posted April 1, 2021 Buenas, Cómo puedo hacer para que solo usuarios con ciertos permisos puedan guardar cambios en las notas privadas de los pedidos? Gracias! Link to comment Share on other sites More sharing options...
ventura Posted April 2, 2021 Share Posted April 2, 2021 Por ejemplo para versiones 1.7.6 /admin/themes/default/template/controllers/orders/helpers/view/view.tpl Buscamos esta parte <div class="panel panel-sm"> <div class="panel-heading"> <i class="icon-eye-slash"></i> {l s='Private note' d='Admin.Orderscustomers.Feature'} {$employee->id_profile} </div> <form id="customer_note" class="form-horizontal" action="{$link->getAdminLink('AdminCustomers', true, [], ['updateCustomerNote' => 1, 'id_customer' => $customer->id])}" method="post" onsubmit="saveCustomerNote();return false;" > <div class="form-group"> <div class="col-lg-12"> <textarea name="note" id="noteContent" class="textarea-autosize" onkeyup="$(this).val().length > 0 ? $('#submitCustomerNote').removeAttr('disabled') : $('#submitCustomerNote').attr('disabled', 'disabled')">{$customer->note}</textarea> </div> </div> <div class="row"> <div class="col-lg-12"> <button type="submit" id="submitCustomerNote" class="btn btn-default pull-right" disabled="disabled"> <i class="icon-save"></i> {l s='Save' d='Admin.Actions'} </button> </div> </div> <span id="note_feedback"></span> </form> </div> Y lo dejamos así {assign var=employee value=Context::getContext()->employee} {if $employee->isSuperAdmin()} <div class="panel panel-sm"> <div class="panel-heading"> <i class="icon-eye-slash"></i> {l s='Private note' d='Admin.Orderscustomers.Feature'} {$employee->id_profile} </div> <form id="customer_note" class="form-horizontal" action="{$link->getAdminLink('AdminCustomers', true, [], ['updateCustomerNote' => 1, 'id_customer' => $customer->id])}" method="post" onsubmit="saveCustomerNote();return false;" > <div class="form-group"> <div class="col-lg-12"> <textarea name="note" id="noteContent" class="textarea-autosize" onkeyup="$(this).val().length > 0 ? $('#submitCustomerNote').removeAttr('disabled') : $('#submitCustomerNote').attr('disabled', 'disabled')">{$customer->note}</textarea> </div> </div> <div class="row"> <div class="col-lg-12"> <button type="submit" id="submitCustomerNote" class="btn btn-default pull-right" disabled="disabled"> <i class="icon-save"></i> {l s='Save' d='Admin.Actions'} </button> </div> </div> <span id="note_feedback"></span> </form> </div> {/if} -Pudiendo condicionar el acceso por perfil Superadministrador {if $employee->isSuperAdmin()} -Por ID de perfil de Usuario, eg para el ID de perfiles 1 { if $employee->id_profile == 1} -Por rango determinado de perfiles de usuario por IDs, eg, para perfiles de usuario con IDs 2 y 5 {if in_array($employee->id_profile, [2, 5])} 1 Link to comment Share on other sites More sharing options...
Eutanasio Posted April 2, 2021 Author Share Posted April 2, 2021 19 minutes ago, ventura said: Por ejemplo para versiones 1.7.6 /admin/themes/default/template/controllers/orders/helpers/view/view.tpl Buscamos esta parte <div class="panel panel-sm"> <div class="panel-heading"> <i class="icon-eye-slash"></i> {l s='Private note' d='Admin.Orderscustomers.Feature'} {$employee->id_profile} </div> <form id="customer_note" class="form-horizontal" action="{$link->getAdminLink('AdminCustomers', true, [], ['updateCustomerNote' => 1, 'id_customer' => $customer->id])}" method="post" onsubmit="saveCustomerNote();return false;" > <div class="form-group"> <div class="col-lg-12"> <textarea name="note" id="noteContent" class="textarea-autosize" onkeyup="$(this).val().length > 0 ? $('#submitCustomerNote').removeAttr('disabled') : $('#submitCustomerNote').attr('disabled', 'disabled')">{$customer->note}</textarea> </div> </div> <div class="row"> <div class="col-lg-12"> <button type="submit" id="submitCustomerNote" class="btn btn-default pull-right" disabled="disabled"> <i class="icon-save"></i> {l s='Save' d='Admin.Actions'} </button> </div> </div> <span id="note_feedback"></span> </form> </div> Y lo dejamos así {assign var=employee value=Context::getContext()->employee} {if $employee->isSuperAdmin()} <div class="panel panel-sm"> <div class="panel-heading"> <i class="icon-eye-slash"></i> {l s='Private note' d='Admin.Orderscustomers.Feature'} {$employee->id_profile} </div> <form id="customer_note" class="form-horizontal" action="{$link->getAdminLink('AdminCustomers', true, [], ['updateCustomerNote' => 1, 'id_customer' => $customer->id])}" method="post" onsubmit="saveCustomerNote();return false;" > <div class="form-group"> <div class="col-lg-12"> <textarea name="note" id="noteContent" class="textarea-autosize" onkeyup="$(this).val().length > 0 ? $('#submitCustomerNote').removeAttr('disabled') : $('#submitCustomerNote').attr('disabled', 'disabled')">{$customer->note}</textarea> </div> </div> <div class="row"> <div class="col-lg-12"> <button type="submit" id="submitCustomerNote" class="btn btn-default pull-right" disabled="disabled"> <i class="icon-save"></i> {l s='Save' d='Admin.Actions'} </button> </div> </div> <span id="note_feedback"></span> </form> </div> {/if} -Pudiendo condicionar el acceso por perfil Superadministrador {if $employee->isSuperAdmin()} -Por ID de perfil de Usuario, eg para el ID de perfiles 1 { if $employee->id_profile == 1} -Por rango determinado de perfiles de usuario por IDs, eg, para perfiles de usuario con IDs 2 y 5 {if in_array($employee->id_profile, [2, 5])} Mil gracias! de perlas, aunque el IF lo he puesto al rededor del botón de guardado nada más, para que los empleados puedan ver el saldo pero no actualizarlo Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now