Activate new rights read and write
This commit is contained in:
parent
436b8fa5b5
commit
1555a95ce8
@ -249,6 +249,22 @@ class modHRM extends DolibarrModules
|
||||
$this->rights[$r][4] = 'compare_advance';
|
||||
$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->compare_advance->read)
|
||||
$r++;
|
||||
|
||||
// Read employee
|
||||
$this->rights[$r][0] = 4031; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Read employee'; // Permission label
|
||||
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
|
||||
$this->rights[$r][4] = 'read_employee';
|
||||
$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->read_employee->read)
|
||||
$r++;
|
||||
|
||||
// Write employee
|
||||
$this->rights[$r][0] = 4032; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Write employee'; // Permission label
|
||||
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
|
||||
$this->rights[$r][4] = 'write_employee';
|
||||
$this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->hrm->write_employee->write)
|
||||
$r++;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -969,6 +969,8 @@ Permission4021=Create/modify your evaluation
|
||||
Permission4022=Validate evaluation
|
||||
Permission4023=Delete evaluation
|
||||
Permission4030=See comparison menu
|
||||
Permission4031=Read employee
|
||||
Permission4032=Write employee
|
||||
Permission10001=Read website content
|
||||
Permission10002=Create/modify website content (html and javascript content)
|
||||
Permission10003=Create/modify website content (dynamic php code). Dangerous, must be reserved to restricted developers.
|
||||
|
||||
@ -78,8 +78,8 @@ if (empty($account->userid)) {
|
||||
|
||||
|
||||
// Define value to know what current user can do on users
|
||||
$canadduser = (!empty($user->admin) || $user->rights->user->user->creer);
|
||||
$canreaduser = (!empty($user->admin) || $user->rights->user->user->lire);
|
||||
$canadduser = (!empty($user->admin) || $user->rights->user->user->creer || $user->rights->hrm->write_employee->write);
|
||||
$canreaduser = (!empty($user->admin) || $user->rights->user->user->lire || $user->rights->hrm->read_employee->read);
|
||||
$permissiontoaddbankaccount = (!empty($user->rights->salaries->write) || !empty($user->rights->hrm->employee->write) || !empty($user->rights->user->creer));
|
||||
|
||||
// Ok if user->rights->salaries->read or user->rights->hrm->read
|
||||
@ -281,7 +281,7 @@ llxHeader(null, $langs->trans("BankAccounts"));
|
||||
|
||||
$head = user_prepare_head($object);
|
||||
|
||||
if ($id && $bankid && $action == 'edit' && $user->rights->user->user->creer) {
|
||||
if ($id && $bankid && $action == 'edit' && ($user->rights->user->user->creer || $user->rights->hrm->write_employee->write)) {
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
@ -446,31 +446,37 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
|
||||
print "</tr>\n";
|
||||
|
||||
// Date of birth
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("DateOfBirth", 'birth', $object->birth, $object, $user->rights->user->user->creer);
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("DateOfBirth", 'birth', $object->birth, $object, $user->rights->user->user->creer, 'day', $object->birth);
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
if ($user->rights->hrm->read_employee->read || $user->rights->hrm->write_employee->write) {
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("DateOfBirth", 'birth', $object->birth, $object, $user->rights->user->user->creer);
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("DateOfBirth", 'birth', $object->birth, $object, $user->rights->user->user->creer, 'day', $object->birth);
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
// Personal email
|
||||
print '<tr class="nowrap">';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->rights->user->user->creer);
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->rights->user->user->creer, 'email', '', null, null, '', 0, 'dol_print_email');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
if ($user->rights->hrm->read_employee->read || $user->rights->hrm->write_employee->write) {
|
||||
print '<tr class="nowrap">';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->rights->user->user->creer || $user->rights->hrm->write_employee->write);
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->rights->user->user->creer || $user->rights->hrm->write_employee->write, 'email', '', null, null, '', 0, 'dol_print_email');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Personal phone
|
||||
print '<tr class="nowrap">';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->rights->user->user->creer);
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->rights->user->user->creer, 'string', '', null, null, '', 0, 'dol_print_phone');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
if ($user->rights->hrm->read_employee->read || $user->rights->hrm->write_employee->write) {
|
||||
print '<tr class="nowrap">';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->rights->user->user->creer || $user->rights->hrm->write_employee->write);
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->rights->user->user->creer || $user->rights->hrm->write_employee->write, 'string', '', null, null, '', 0, 'dol_print_phone');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) {
|
||||
print '<tr class="nowrap">';
|
||||
@ -527,22 +533,26 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
|
||||
}
|
||||
|
||||
// Employee Number
|
||||
print '<tr class="nowrap">';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("RefEmployee", 'ref_employee', $object->ref_employee, $object, $user->rights->user->user->creer);
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("RefEmployee", 'ref_employee', $object->ref_employee, $object, $user->rights->user->user->creer, 'string', $object->ref_employee);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
if ($user->rights->hrm->read_employee->read || $user->rights->hrm->write_employee->write) {
|
||||
print '<tr class="nowrap">';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("RefEmployee", 'ref_employee', $object->ref_employee, $object, $user->rights->user->user->creer || $user->rights->hrm->write_employee->write);
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("RefEmployee", 'ref_employee', $object->ref_employee, $object, $user->rights->user->user->creer || $user->rights->hrm->write_employee->write, 'string', $object->ref_employee);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// National registration number
|
||||
print '<tr class="nowrap">';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("NationalRegistrationNumber", 'national_registration_number', $object->national_registration_number, $object, $user->rights->user->user->creer);
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("NationalRegistrationNumber", 'national_registration_number', $object->national_registration_number, $object, $user->rights->user->user->creer, 'string', $object->national_registration_number);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
if ($user->rights->hrm->read_employee->read || $user->rights->hrm->write_employee->write) {
|
||||
print '<tr class="nowrap">';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("NationalRegistrationNumber", 'national_registration_number', $object->national_registration_number, $object, $user->rights->user->user->creer || $user->rights->hrm->write_employee->write);
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("NationalRegistrationNumber", 'national_registration_number', $object->national_registration_number, $object, $user->rights->user->user->creer || $user->rights->hrm->write_employee->write, 'string', $object->national_registration_number);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user