mirror of
https://github.com/grocy/grocy.git
synced 2026-04-06 21:06:15 +02:00
Add default permissions for new users
This commit is contained in:
parent
5cb08db737
commit
de3907eabc
|
|
@ -172,3 +172,5 @@ Setting('FEATURE_FLAG_CHORES_ASSIGNMENTS', true);
|
|||
# Feature settings
|
||||
Setting('FEATURE_SETTING_STOCK_COUNT_OPENED_PRODUCTS_AGAINST_MINIMUM_STOCK_AMOUNT', true); // When set to true opened items will be counted as missing from stock when calculating if a product is below its minimum.
|
||||
Setting('FEATURE_FLAG_AUTO_TORCH_ON_WITH_CAMERA', true); // Enables the torch automaticaly in every camera barcode scanner.
|
||||
|
||||
Setting('DEFAULT_PERMISSIONS', ['ADMIN']);
|
||||
|
|
@ -12,7 +12,17 @@ class UsersService extends BaseService
|
|||
'last_name' => $lastName,
|
||||
'password' => password_hash($password, PASSWORD_DEFAULT)
|
||||
));
|
||||
return $newUserRow->save();
|
||||
$newUserRow = $newUserRow->save();
|
||||
$permList = array();
|
||||
foreach ($this->getDatabase()->permission_hierarchy()->where('name', GROCY_DEFAULT_PERMISSIONS)->fetchAll() as $perm) {
|
||||
$permList[] = array(
|
||||
'user_id' => $newUserRow->id,
|
||||
'permission_id' => $perm->id
|
||||
);
|
||||
}
|
||||
$this->getDatabase()->user_permissions()->insert($permList);
|
||||
|
||||
return $newUserRow;
|
||||
}
|
||||
|
||||
public function EditUser(int $userId, string $username, string $firstName, string $lastName, string $password)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user