Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add user_may_edit boolean to event #398

Open
Rikuoja opened this issue Mar 13, 2020 · 3 comments
Open

Add user_may_edit boolean to event #398

Rikuoja opened this issue Mar 13, 2020 · 3 comments

Comments

@Rikuoja
Copy link
Contributor

Rikuoja commented Mar 13, 2020

For authenticated users, the API knows whether the user has rights to edit each event or not (already used for displaying fields such as created_by and last_modified_by, https://github.com/City-of-Helsinki/linkedevents/blob/master/events/api.py#L452).

Adding this field would be as easy as adding a field user_may_edit=True to only_admin_visible_fields.

@Rikuoja
Copy link
Contributor Author

Rikuoja commented Mar 13, 2020

Required for City-of-Helsinki/linkedevents-ui#532

@Rikuoja
Copy link
Contributor Author

Rikuoja commented Mar 13, 2020

Tho, there is a catch. The user may not edit all events that display those fields, if they are in different branches of the same organization tree :D Creator data is shown for admins within the organization even if they may not edit the event.

So, another check is indeed needed to actually see whether we should return True or False.

@Rikuoja
Copy link
Contributor Author

Rikuoja commented Mar 13, 2020

And, indeed, we should probably display this as True for regular users in draft events, even though they do not see the other admin fields at the moment :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant