fix(users): Adding warehouse as valid role in clean_data function
This commit is contained in:
@@ -94,8 +94,15 @@ function clean_user_data( data , company ){
|
|||||||
if( data.password ){ delete data.password; }
|
if( data.password ){ delete data.password; }
|
||||||
if( data.company ){ delete data.company; }
|
if( data.company ){ delete data.company; }
|
||||||
if( data.job_role ){
|
if( data.job_role ){
|
||||||
|
/** You can only modify the role of a user if it is in the following list */
|
||||||
|
const modifiable_roles = [
|
||||||
|
'manager',
|
||||||
|
'driver',
|
||||||
|
'staff',
|
||||||
|
'warehouse'
|
||||||
|
];
|
||||||
/// System can only create manager,driver or staff.
|
/// System can only create manager,driver or staff.
|
||||||
if( (data.job_role !== "manager") && (data.job_role !== "driver") && (data.job_role !== "staff") ){
|
if( !modifiable_roles.includes( data.job_role ) ){
|
||||||
data.job_role = "staff";
|
data.job_role = "staff";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user