1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-05 13:35:23 +02:00

feat(frontend): add group permissions (#721)

* style(frontend): 💄 add darktheme custom

* add dummy users in dev mode

* feat(frontend):  add group permissions editor UI

* feat(backend):  add group permissions setters

* test(backend):  tests for basic permission get/set (WIP)

Needs more testing

* remove old test

* chore(backend): copy template.env on setup

* feat(frontend):  enable send invitation via email

* feat(backend):  enable send invitation via email

* feat:  add app config checker for site-settings

* refactor(frontend): ♻️ consolidate bool checks

Co-authored-by: Hayden <hay-kot@pm.me>
This commit is contained in:
Hayden 2021-10-04 20:16:37 -08:00 committed by GitHub
parent b7b8aa9a08
commit 5d43fac7c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 652 additions and 106 deletions

View file

@ -4,6 +4,7 @@ from tests.utils.factories import user_registration_factory
class Routes:
self = "/api/users/self"
base = "/api/users/register"
auth_token = "/api/auth/token"
@ -22,3 +23,31 @@ def test_user_registration_new_group(api_client: TestClient):
token = response.json().get("access_token")
assert token is not None
def test_new_user_group_permissions(api_client: TestClient):
registration = user_registration_factory()
response = api_client.post(Routes.base, json=registration.dict(by_alias=True))
assert response.status_code == 201
# Login
form_data = {"username": registration.email, "password": registration.password}
response = api_client.post(Routes.auth_token, form_data)
assert response.status_code == 200
token = response.json().get("access_token")
assert token is not None
# Get User
headers = {"Authorization": f"Bearer {token}"}
response = api_client.get(Routes.self, headers=headers)
assert response.status_code == 200
user = response.json()
assert user.get("canInvite") is True
assert user.get("canManage") is True
assert user.get("canOrganize") is True