-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mgr/dashboard: validate username while creation
When creating a user the username is not checked if it's valid from the Ceph perspective (`CephString`). The commit adds a decorator to check if the input values in the API are valid from the Ceph perspective by calling the `valid()` method of the Ceph-defined datatypes (`ceph_argparse.py`). Fixes: https://tracker.ceph.com/issues/46548 Signed-off-by: Tatjana Dehler <[email protected]>
- Loading branch information
Tatjana Dehler
committed
Nov 16, 2020
1 parent
6441771
commit fbf1c37
Showing
4 changed files
with
34 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,6 +169,16 @@ def test_create_user_invalid_role(self): | |
self.assertError(code='role_does_not_exist', | ||
component='user') | ||
|
||
def test_create_user_invalid_chars_in_name(self): | ||
self._create_user(username='userö', | ||
password='mypassword10#', | ||
name='administrator', | ||
email='[email protected]', | ||
roles=['administrator']) | ||
self.assertStatus(400) | ||
self.assertError(code='ceph_type_not_valid', | ||
component='user') | ||
|
||
def test_delete_user_does_not_exist(self): | ||
self._delete('/api/user/user2') | ||
self.assertStatus(404) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters