mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
To be consistent with migration 0020, all new users should have /bin/bash as terminal, also we probably don't care about fetching loginShell anymore
This commit is contained in:
parent
f0c4498c80
commit
fb1fddd07e
3 changed files with 2 additions and 23 deletions
|
@ -151,8 +151,6 @@ def _get_user_for_ssh(username, attrs=None):
|
|||
"username": "root",
|
||||
"fullname": "",
|
||||
"mail": "",
|
||||
"ssh_allowed": ssh_root_login_status()["PermitRootLogin"],
|
||||
"shell": root_unix.pw_shell,
|
||||
"home_path": root_unix.pw_dir,
|
||||
}
|
||||
|
||||
|
@ -162,8 +160,6 @@ def _get_user_for_ssh(username, attrs=None):
|
|||
"username": "admin",
|
||||
"fullname": "",
|
||||
"mail": "",
|
||||
"ssh_allowed": admin_unix.pw_shell.strip() != "/bin/false",
|
||||
"shell": admin_unix.pw_shell,
|
||||
"home_path": admin_unix.pw_dir,
|
||||
}
|
||||
|
||||
|
|
|
@ -1206,7 +1206,6 @@ def test_parse_args_in_yunohost_format_user_empty():
|
|||
"some_user": {
|
||||
"ssh_allowed": False,
|
||||
"username": "some_user",
|
||||
"shell": "/bin/false",
|
||||
"mailbox-quota": "0",
|
||||
"mail": "p@ynh.local",
|
||||
"fullname": "the first name the last name",
|
||||
|
@ -1232,7 +1231,6 @@ def test_parse_args_in_yunohost_format_user():
|
|||
username: {
|
||||
"ssh_allowed": False,
|
||||
"username": "some_user",
|
||||
"shell": "/bin/false",
|
||||
"mailbox-quota": "0",
|
||||
"mail": "p@ynh.local",
|
||||
"fullname": "the first name the last name",
|
||||
|
@ -1261,7 +1259,6 @@ def test_parse_args_in_yunohost_format_user_two_users():
|
|||
username: {
|
||||
"ssh_allowed": False,
|
||||
"username": "some_user",
|
||||
"shell": "/bin/false",
|
||||
"mailbox-quota": "0",
|
||||
"mail": "p@ynh.local",
|
||||
"fullname": "the first name the last name",
|
||||
|
@ -1269,7 +1266,6 @@ def test_parse_args_in_yunohost_format_user_two_users():
|
|||
other_user: {
|
||||
"ssh_allowed": False,
|
||||
"username": "some_user",
|
||||
"shell": "/bin/false",
|
||||
"mailbox-quota": "0",
|
||||
"mail": "z@ynh.local",
|
||||
"fullname": "john doe",
|
||||
|
@ -1304,7 +1300,6 @@ def test_parse_args_in_yunohost_format_user_two_users_wrong_answer():
|
|||
username: {
|
||||
"ssh_allowed": False,
|
||||
"username": "some_user",
|
||||
"shell": "/bin/false",
|
||||
"mailbox-quota": "0",
|
||||
"mail": "p@ynh.local",
|
||||
"fullname": "the first name the last name",
|
||||
|
@ -1312,7 +1307,6 @@ def test_parse_args_in_yunohost_format_user_two_users_wrong_answer():
|
|||
other_user: {
|
||||
"ssh_allowed": False,
|
||||
"username": "some_user",
|
||||
"shell": "/bin/false",
|
||||
"mailbox-quota": "0",
|
||||
"mail": "z@ynh.local",
|
||||
"fullname": "john doe",
|
||||
|
@ -1339,7 +1333,6 @@ def test_parse_args_in_yunohost_format_user_two_users_no_default():
|
|||
username: {
|
||||
"ssh_allowed": False,
|
||||
"username": "some_user",
|
||||
"shell": "/bin/false",
|
||||
"mailbox-quota": "0",
|
||||
"mail": "p@ynh.local",
|
||||
"fullname": "the first name the last name",
|
||||
|
@ -1347,7 +1340,6 @@ def test_parse_args_in_yunohost_format_user_two_users_no_default():
|
|||
other_user: {
|
||||
"ssh_allowed": False,
|
||||
"username": "some_user",
|
||||
"shell": "/bin/false",
|
||||
"mailbox-quota": "0",
|
||||
"mail": "z@ynh.local",
|
||||
"fullname": "john doe",
|
||||
|
@ -1369,7 +1361,6 @@ def test_parse_args_in_yunohost_format_user_two_users_default_input():
|
|||
username: {
|
||||
"ssh_allowed": False,
|
||||
"username": "some_user",
|
||||
"shell": "/bin/false",
|
||||
"mailbox-quota": "0",
|
||||
"mail": "p@ynh.local",
|
||||
"fullname": "the first name the last name",
|
||||
|
@ -1377,7 +1368,6 @@ def test_parse_args_in_yunohost_format_user_two_users_default_input():
|
|||
other_user: {
|
||||
"ssh_allowed": False,
|
||||
"username": "some_user",
|
||||
"shell": "/bin/false",
|
||||
"mailbox-quota": "0",
|
||||
"mail": "z@ynh.local",
|
||||
"fullname": "john doe",
|
||||
|
|
|
@ -53,7 +53,6 @@ def user_list(fields=None):
|
|||
"cn": "fullname",
|
||||
"mail": "mail",
|
||||
"maildrop": "mail-forward",
|
||||
"loginShell": "shell",
|
||||
"homeDirectory": "home_path",
|
||||
"mailuserquota": "mailbox-quota",
|
||||
}
|
||||
|
@ -69,7 +68,7 @@ def user_list(fields=None):
|
|||
else:
|
||||
raise YunohostError("field_invalid", attr)
|
||||
else:
|
||||
attrs = ["uid", "cn", "mail", "mailuserquota", "loginShell"]
|
||||
attrs = ["uid", "cn", "mail", "mailuserquota"]
|
||||
|
||||
ldap = _get_ldap_interface()
|
||||
result = ldap.search(
|
||||
|
@ -82,12 +81,6 @@ def user_list(fields=None):
|
|||
entry = {}
|
||||
for attr, values in user.items():
|
||||
if values:
|
||||
if attr == "loginShell":
|
||||
if values[0].strip() == "/bin/false":
|
||||
entry["ssh_allowed"] = False
|
||||
else:
|
||||
entry["ssh_allowed"] = True
|
||||
|
||||
entry[user_attrs[attr]] = values[0]
|
||||
|
||||
uid = entry[user_attrs["uid"]]
|
||||
|
@ -206,7 +199,7 @@ def user_create(
|
|||
"gidNumber": [uid],
|
||||
"uidNumber": [uid],
|
||||
"homeDirectory": ["/home/" + username],
|
||||
"loginShell": ["/bin/false"],
|
||||
"loginShell": ["/bin/bash"],
|
||||
}
|
||||
|
||||
# If it is the first user, add some aliases
|
||||
|
|
Loading…
Add table
Reference in a new issue