mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
be able to change the loginShell of a user
This commit is contained in:
parent
70a8225b1d
commit
7372dc2079
1 changed files with 11 additions and 1 deletions
12
src/user.py
12
src/user.py
|
@ -134,6 +134,7 @@ def user_create(
|
||||||
lastname=None,
|
lastname=None,
|
||||||
mailbox_quota="0",
|
mailbox_quota="0",
|
||||||
admin=False,
|
admin=False,
|
||||||
|
loginShell="/bin/bash",
|
||||||
from_import=False,
|
from_import=False,
|
||||||
):
|
):
|
||||||
|
|
||||||
|
@ -253,7 +254,7 @@ def user_create(
|
||||||
"gidNumber": [uid],
|
"gidNumber": [uid],
|
||||||
"uidNumber": [uid],
|
"uidNumber": [uid],
|
||||||
"homeDirectory": ["/home/" + username],
|
"homeDirectory": ["/home/" + username],
|
||||||
"loginShell": ["/bin/bash"],
|
"loginShell": [loginShell],
|
||||||
}
|
}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -363,6 +364,7 @@ def user_update(
|
||||||
mailbox_quota=None,
|
mailbox_quota=None,
|
||||||
from_import=False,
|
from_import=False,
|
||||||
fullname=None,
|
fullname=None,
|
||||||
|
loginShell=None,
|
||||||
):
|
):
|
||||||
|
|
||||||
if firstname or lastname:
|
if firstname or lastname:
|
||||||
|
@ -524,6 +526,10 @@ def user_update(
|
||||||
new_attr_dict["mailuserquota"] = [mailbox_quota]
|
new_attr_dict["mailuserquota"] = [mailbox_quota]
|
||||||
env_dict["YNH_USER_MAILQUOTA"] = mailbox_quota
|
env_dict["YNH_USER_MAILQUOTA"] = mailbox_quota
|
||||||
|
|
||||||
|
if loginShell is not None:
|
||||||
|
new_attr_dict["loginShell"] = [loginShell]
|
||||||
|
env_dict["YNH_USER_LOGINSHELL"] = loginShell
|
||||||
|
|
||||||
if not from_import:
|
if not from_import:
|
||||||
operation_logger.start()
|
operation_logger.start()
|
||||||
|
|
||||||
|
@ -532,6 +538,10 @@ def user_update(
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise YunohostError("user_update_failed", user=username, error=e)
|
raise YunohostError("user_update_failed", user=username, error=e)
|
||||||
|
|
||||||
|
# Invalidate passwd and group to update the loginShell
|
||||||
|
subprocess.call(["nscd", "-i", "passwd"])
|
||||||
|
subprocess.call(["nscd", "-i", "group"])
|
||||||
|
|
||||||
# Trigger post_user_update hooks
|
# Trigger post_user_update hooks
|
||||||
hook_callback("post_user_update", env=env_dict)
|
hook_callback("post_user_update", env=env_dict)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue