Skip to content

Feature/41086 work package assigned capability#10244

Merged
oliverguenther merged 4 commits into
devfrom
feature/41086-work-package-assigned-capability
Mar 7, 2022
Merged

Feature/41086 work package assigned capability#10244
oliverguenther merged 4 commits into
devfrom
feature/41086-work-package-assigned-capability

Conversation

@ulferts
Copy link
Copy Markdown
Contributor

@ulferts ulferts commented Mar 1, 2022

Introduces a permission that when granted, allows a user to have work packages assigned to her/him. This replaces the flag on members assignable that previously governed the same behaviour.

This is also reflected in the role administration where the newly introduced passive permission was added to the work packages fieldset.

image

As this permission might be hard to understand, the ability to add explanations for a permission was introduced.

The change was made mostly so that the permission can become part of the capabilities api in the form of work_packages/assigned. Currently, this is meant to represent both the ability to become assignee as well as responsible but if necessary, this can be split up.

Because administrators should not receive this permission, a new flag is introduced for permissions to govern this which required changes to various permission queries.

When working on fixing specs, a former patch was now properly included into the previously patched file since the distinction is no longer necessary and causes errors at least when run in development mode (cost types where not displayed on cost report page).

The migration included not only replaced the assignable column but also removes role_permissions entries that are orphaned as the referenced role got removed. This should no longer happen now since the relation now has a dependent: :destroy added to it.

Lessons learned

Currently, there are various places in which permissions are derived from the originally involved tables: members, member_roles, roles, role_permissions. Those all have to be altered when the way permissions are checked changes. Additionally, this is all done repeatedly whenever a permission needs to be checked.

It might be worthwhile to calculate the active permissions into a persisted view consisting of the columns principal_id, project_id, permission which gets updated whenever the original tables are altered but after that serve as the source of truth for whenever permissions are checked.

That way, checking permissions will become very easy and performant.

Updating can the view can happen asynchronously but needs to happen whenever the original data changes. This can be done either on the database level via database triggers or via update requests issued from rails.

TODO

  • Introduce new permission
  • Remove assignable column
  • Add migration so that every role having had assignable = true receives the new permission
  • Rework the role UI form where the assignable property is modified.

https://community.openproject.org/wp/41086

@ulferts ulferts added feature ruby Pull requests that update Ruby code labels Mar 1, 2022
@ulferts ulferts force-pushed the feature/41086-work-package-assigned-capability branch 9 times, most recently from cdc718d to e7e5e8b Compare March 3, 2022 10:19
@ulferts ulferts force-pushed the feature/41086-work-package-assigned-capability branch from e7e5e8b to 112a085 Compare March 3, 2022 10:40
@ulferts ulferts force-pushed the feature/41086-work-package-assigned-capability branch from 112a085 to d18f60a Compare March 3, 2022 11:51
@ulferts ulferts marked this pull request as ready for review March 3, 2022 12:06
Copy link
Copy Markdown
Member

@oliverguenther oliverguenther left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worthwhile to calculate the active permissions into a persisted view consisting of the columns principal_id, project_id, permission which gets updated whenever the original tables are altered but after that serve as the source of truth for whenever permissions are checked.

That way, checking permissions will become very easy and performant.

  • 1 from my side.

@oliverguenther oliverguenther merged commit 6ae0926 into dev Mar 7, 2022
@oliverguenther oliverguenther deleted the feature/41086-work-package-assigned-capability branch March 7, 2022 09:52
akabiru added a commit that referenced this pull request May 6, 2026
…antic ids

The autocomplete dropdown in CKEditor renders each result with
`item.name = wp.to_s`, and `to_s` hardcoded `##{id}` — so a semantic-mode
search for `#KSTP-2` resolved correctly but the dropdown row showed
`Task #10244: Subject` instead of `Task KSTP-2: Subject`.

Switch to `formatted_id`, which already produces the user-facing form in
both modes (`PROJ-7` semantic, `#42` classic). The other caller — the
delete-dialog component — benefits from the same mode awareness.
akabiru added a commit that referenced this pull request May 7, 2026
…antic ids

The autocomplete dropdown in CKEditor renders each result with
`item.name = wp.to_s`, and `to_s` hardcoded `##{id}` — so a semantic-mode
search for `#KSTP-2` resolved correctly but the dropdown row showed
`Task #10244: Subject` instead of `Task KSTP-2: Subject`.

Switch to `formatted_id`, which already produces the user-facing form in
both modes (`PROJ-7` semantic, `#42` classic). The other caller — the
delete-dialog component — benefits from the same mode awareness.
pull Bot pushed a commit to soitun/openproject that referenced this pull request May 14, 2026
…antic ids

The autocomplete dropdown in CKEditor renders each result with
`item.name = wp.to_s`, and `to_s` hardcoded `##{id}` — so a semantic-mode
search for `#KSTP-2` resolved correctly but the dropdown row showed
`Task opf#10244: Subject` instead of `Task KSTP-2: Subject`.

Switch to `formatted_id`, which already produces the user-facing form in
both modes (`PROJ-7` semantic, `#42` classic). The other caller — the
delete-dialog component — benefits from the same mode awareness.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature ruby Pull requests that update Ruby code

Development

Successfully merging this pull request may close these issues.

2 participants