Skip to content

Commit

Permalink
Give HS user permissions (#727)
Browse files Browse the repository at this point in the history
* Give HS user permissions

* Fix
  • Loading branch information
thomsen85 authored Oct 23, 2023
1 parent cff144e commit 1ddbf1f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
---

## Neste versjon
-**Brukere** HS kan styre medlemmer
-**Bannere** Filtrering på bannere
-**Spørreskjemaer** NOK medlemmer kan lage spørreskjema.
-**Bruker** Nå kan ikke HS lenger endre eller slette brukere.
Expand Down
3 changes: 1 addition & 2 deletions app/content/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def create_superuser(self, user_id, password):


class User(AbstractBaseUser, PermissionsMixin, BaseModel, OptionalImage):
write_access = [AdminGroup.INDEX]
write_access = AdminGroup.admin()
read_access = [Groups.TIHLDE]

user_id = models.CharField(max_length=15, primary_key=True)
Expand Down Expand Up @@ -161,7 +161,6 @@ def has_unanswered_evaluations_for(self, event):
return self.get_unanswered_evaluations().filter(event=event).exists()

def get_unanswered_evaluations(self):

from app.forms.models.forms import EventForm, EventFormType

date_30_days_ago = now() - timedelta(days=30)
Expand Down
5 changes: 2 additions & 3 deletions app/tests/content/test_user_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ def test_filter_only_users_with_active_strikes(
],
)
def test_user_actions_self(url, status_code, member, api_client):

url = f"{API_USER_BASE_URL}me{url}"
client = api_client(user=member)

Expand Down Expand Up @@ -341,7 +340,7 @@ def test_update_other_user_as_hs_user(member, user, api_client):
url = _get_user_detail_url(user)
response = client.put(url, data)

assert response.status_code == status.HTTP_403_FORBIDDEN
assert response.status_code == status.HTTP_200_OK


def test_update_other_user_as_index_user(member, user, api_client):
Expand Down Expand Up @@ -459,7 +458,7 @@ def test_destroy_other_user_as_hs_user(member, user, api_client):
url = _get_user_detail_url(user)
response = client.delete(url)

assert response.status_code == status.HTTP_403_FORBIDDEN
assert response.status_code == status.HTTP_200_OK


def test_destroy_other_user_as_index_user(member, user, api_client):
Expand Down

0 comments on commit 1ddbf1f

Please sign in to comment.