Skip to content

Commit 56a2d5a

Browse files
committed
feat(api): expose mail and password info
Extra info will be used by the domain users cluster page.
1 parent f2ddc65 commit 56a2d5a

File tree

4 files changed

+39
-4
lines changed

4 files changed

+39
-4
lines changed

imageroot/actions/add-user/50add_user

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
# along with NethServer. If not, see COPYING.
2121
#
2222

23-
import agent
2423
import json
2524
import sys
2625
import subprocess
@@ -31,6 +30,7 @@ groups = request.get('groups', [])
3130
password = request.get('password', '') # Empty string implies a random password is set
3231
display_name = request.get('display_name', '')
3332
locked = request.get('locked', False)
33+
mail = request.get('mail', '')
3434

3535
adduser_cmd = ['podman', 'exec', '-i', 'openldap', 'add-user']
3636

@@ -46,6 +46,9 @@ else:
4646
if display_name:
4747
adduser_cmd += ['-d', display_name]
4848

49+
if mail:
50+
adduser_cmd += ['-m', mail]
51+
4952
adduser_cmd.append(user)
5053

5154
subprocess.run(adduser_cmd, input=password, stdout=sys.stderr, check=True, text=True)

imageroot/actions/add-user/validate-input.json

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"locked": false,
1313
"groups": [
1414
"developers"
15-
]
15+
],
16+
1617
}
1718
],
1819
"required": [
@@ -51,6 +52,20 @@
5152
"type": "string",
5253
"minLength": 1
5354
}
55+
},
56+
"mail": {
57+
"title": "Email address",
58+
"type": "string",
59+
"oneOf": [
60+
{
61+
"type": "string",
62+
"format": "email"
63+
},
64+
{
65+
"type": "string",
66+
"maxLength": 0
67+
}
68+
]
5469
}
5570
},
5671
"$defs": {}

imageroot/actions/alter-user/50alter_user

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
# along with NethServer. If not, see COPYING.
2121
#
2222

23-
import agent
2423
import json
2524
import sys
2625
import subprocess
@@ -45,6 +44,9 @@ if 'locked' in request:
4544
else:
4645
alteruser_cmd += ['-u']
4746

47+
if 'mail' in request:
48+
alteruser_cmd += ['-m', request['mail']]
49+
4850
alteruser_cmd.append(user)
4951

5052
subprocess.run(alteruser_cmd, input=request.get('password'), stdout=sys.stderr, check=True, text=True)

imageroot/actions/alter-user/validate-input.json

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"locked": "false",
1313
"groups": [
1414
"developers","managers"
15-
]
15+
],
16+
1617
}
1718
],
1819
"required": [
@@ -51,6 +52,20 @@
5152
"type": "boolean",
5253
"title": "Locked",
5354
"description": "True, if the user account has been locked, preventing the user from logging in"
55+
},
56+
"mail": {
57+
"title": "Email address",
58+
"type": "string",
59+
"oneOf": [
60+
{
61+
"type": "string",
62+
"format": "email"
63+
},
64+
{
65+
"type": "string",
66+
"maxLength": 0
67+
}
68+
]
5469
}
5570
},
5671
"$defs": {}

0 commit comments

Comments
 (0)