-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #324 from MerginMaps/develop-redesign-admin
Admin redesign
- Loading branch information
Showing
344 changed files
with
5,100 additions
and
19,055 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -183,20 +183,13 @@ paths: | |
- $ref: "#/components/parameters/Page" | ||
- $ref: "#/components/parameters/PerPage" | ||
- $ref: "#/components/parameters/OrderParams" | ||
- name: name | ||
- name: like | ||
in: query | ||
description: Filter projects by name with ilike pattern | ||
description: Filter projects by name or workspace name with ilike pattern | ||
required: false | ||
schema: | ||
type: string | ||
example: survey | ||
- name: workspace | ||
in: query | ||
description: Filter projects by workspace with ilike pattern | ||
required: false | ||
schema: | ||
type: string | ||
example: my-workspace | ||
responses: | ||
"200": | ||
description: List of projects | ||
|
@@ -209,7 +202,7 @@ paths: | |
type: integer | ||
description: Total number of all projects | ||
example: 20 | ||
projects: | ||
items: | ||
type: array | ||
items: | ||
$ref: "#/components/schemas/ProjectListItem" | ||
|
@@ -292,7 +285,7 @@ paths: | |
id: | ||
type: string | ||
format: uuid | ||
example: 'd4ecda97-0595-40af-892c-e7522de70bd2' | ||
example: "d4ecda97-0595-40af-892c-e7522de70bd2" | ||
name: | ||
type: string | ||
example: survey | ||
|
@@ -460,7 +453,7 @@ components: | |
- detail | ||
UsersLimitHit: | ||
allOf: | ||
- $ref: '#/components/schemas/CustomError' | ||
- $ref: "#/components/schemas/CustomError" | ||
type: object | ||
properties: | ||
rejected_emails: | ||
|
@@ -473,7 +466,7 @@ components: | |
example: | ||
code: UsersLimitHit | ||
detail: Maximum number of people in this workspace is reached. Please upgrade your subscription to add more people (UsersLimitHit) | ||
rejected_emails: [ [email protected] ] | ||
rejected_emails: [[email protected]] | ||
users_quota: 6 | ||
ProjectAccessRequestList: | ||
type: array | ||
|
@@ -488,7 +481,7 @@ components: | |
project_id: | ||
type: string | ||
format: uuid | ||
example: 'd4ecda97-0595-40af-892c-e7522de70bd2' | ||
example: "d4ecda97-0595-40af-892c-e7522de70bd2" | ||
project_name: | ||
type: string | ||
example: survey | ||
|
@@ -619,25 +612,25 @@ components: | |
nullable: false | ||
items: | ||
type: string | ||
example: [ john.doe ] | ||
example: [john.doe] | ||
writersnames: | ||
type: array | ||
nullable: false | ||
items: | ||
type: string | ||
example: [ john.doe ] | ||
example: [john.doe] | ||
editorsnames: | ||
type: array | ||
nullable: false | ||
items: | ||
type: string | ||
example: [ john.doe ] | ||
example: [john.doe] | ||
readersnames: | ||
nullable: false | ||
type: array | ||
items: | ||
type: string | ||
example: [ john.doe ] | ||
example: [john.doe] | ||
public: | ||
type: boolean | ||
example: true | ||
|
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
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 |
---|---|---|
|
@@ -412,6 +412,25 @@ def test_api_user_profile(client): | |
def test_update_user(client): | ||
login_as_admin(client) | ||
user = User.query.filter_by(username="mergin").first() | ||
data = {"active": True, "is_admin": True} | ||
resp = client.patch( | ||
url_for("/.mergin_auth_controller_update_user", username=user.username), | ||
data=json.dumps(data), | ||
headers=json_headers, | ||
) | ||
assert resp.status_code == 200 | ||
assert user.active | ||
assert user.is_admin | ||
|
||
client.application.config["ENABLE_SUPERADMIN_ASSIGNMENT"] = False | ||
data = {"active": False, "is_admin": False} | ||
resp = client.patch( | ||
url_for("/.mergin_auth_controller_update_user", username=user.username), | ||
data=json.dumps(data), | ||
headers=json_headers, | ||
) | ||
assert resp.status_code == 400 | ||
assert user.active | ||
data = {"active": False} | ||
resp = client.patch( | ||
url_for("/.mergin_auth_controller_update_user", username=user.username), | ||
|
@@ -421,6 +440,7 @@ def test_update_user(client): | |
assert resp.status_code == 200 | ||
assert not user.active | ||
|
||
client.application.config["ENABLE_SUPERADMIN_ASSIGNMENT"] = True | ||
user.is_admin = False | ||
db.session.add(user) | ||
db.session.commit() | ||
|
@@ -694,27 +714,27 @@ def test_paginate_users(client): | |
url = "/app/admin/users?page=1&per_page=10" | ||
# get 5 users (default + 5 new added - 1 deleted & inactive) | ||
resp = client.get(url) | ||
list_of_usernames = [user["username"] for user in resp.json["users"]] | ||
assert resp.json["total"] == 5 | ||
assert resp.json["users"][0]["username"] == "mergin" | ||
list_of_usernames = [user["username"] for user in resp.json["items"]] | ||
assert resp.json["count"] == 5 | ||
assert resp.json["items"][0]["username"] == "mergin" | ||
assert user_inactive.username in list_of_usernames | ||
assert deleted_active.username in list_of_usernames | ||
assert deleted_inactive.username not in list_of_usernames | ||
# order by username | ||
resp = client.get(url + "&order_by=username") | ||
assert resp.json["total"] == 5 | ||
assert resp.json["users"][0]["username"] == "alice" | ||
assert resp.json["count"] == 5 | ||
assert resp.json["items"][0]["username"] == "alice" | ||
# exact match with username | ||
resp = client.get(url + "&like=bob") | ||
assert resp.json["total"] == 1 | ||
assert resp.json["users"][0]["username"] == "bob" | ||
assert resp.json["count"] == 1 | ||
assert resp.json["items"][0]["username"] == "bob" | ||
# ilike search with email | ||
resp = client.get(url + "&[email protected]") | ||
assert resp.json["total"] == 5 | ||
assert resp.json["count"] == 5 | ||
# exact search by email | ||
resp = client.get(url + "&[email protected]") | ||
assert resp.json["total"] == 1 | ||
assert resp.json["users"][0]["username"] == "alice" | ||
assert resp.json["count"] == 1 | ||
assert resp.json["items"][0]["username"] == "alice" | ||
# invalid paging | ||
assert client.get("/app/admin/users?page=2&per_page=10").status_code == 404 | ||
|
||
|
Oops, something went wrong.