Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Merge remote-tracking branch 'origin/release/13.0' into dev

ulferts65b8a98588cf
diff --cc Gemfile.lock
index a12b0da75b9,d29d028652a..24f3c98ac03
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@@ -1138,13 -1116,13 +1138,13 @@@ DEPENDENCIE
pry-byebug (~> 3.10.0)
pry-rails (~> 0.3.6)
pry-rescue (~> 1.5.2)
- puffing-billy (~> 3.1.0)
+ puffing-billy (~> 4.0.0)
- puma (~> 6.3)
+ puma (~> 6.3, >= 6.3.1)
puma-plugin-statsd (~> 2.0)
- rack-attack (~> 6.6.0)
+ rack-attack (~> 6.7.0)
rack-cors (~> 2.0.0)
rack-mini-profiler
- rack-protection (~> 3.0.0)
+ rack-protection (~> 3.1.0)
rack-test (~> 2.1.0)
rack-timeout (~> 0.6.3)
rack_session_access
diff --cc docs/development/concepts/permissions/README.md
index baea9f5469b,87489fedc18..b6e36b7e3c1
--- a/docs/development/concepts/permissions/README.md
+++ b/docs/development/concepts/permissions/README.md
@@@ -90,13 -102,11 +90,13 @@@ However, for most end points, this doe
When a set of records is to be returned, e.g. for an index action, it is best to limit the returned result set to the records the user is allowed to see. To avoid having to apply the permission check after the records have been fetched and instantiated, which is costly, it is best to limit the records in the sql right away. As there are a couple of different scenarios for fetching records, there are a couple of matching scopes defined:
- | Schenario | Scope | Example |
- |---------- | ------| ------ |
+ | Scenario | Scope | Example |
+ |--------- | ------| ------- |
| All projects a user is allowed a permission in | `Authorization.projects(permission, user)` | `Authorization.projects(:view_work_packages, User.current)` |
-| All users granted a permission in a project | `Authorization.users(permission, project)` | `Authorization.users(:view_work_packages, project)` |
-| All roles a user has in a project or globally | `Authorization.roles(user, project = nil)` | `Authorization.roles(User.current, project)`, `Authorization.roles(User.current)` |
+| All users granted a permission in a project | `Authorization.users(permission, project: project)` | `Authorization.users(:view_work_packages, project: project)` |
+| All roles a user has in a project | `Authorization.roles(user, project)` | `Authorization.roles(User.current, project)` |
+| All roles a user has for a specific resource | `Authorization.roles(user, entity)` | `Authorization.roles(User.current, work_package)` |
+| All roles a user has globally | `Authorization.roles(user)` | `Authorization.roles(User.current)` |
Most of the time, a developer will not witness those queries as they are the embedded deeply within the existing scopes. E.g. the `visible` scopes defined for most AR models, under the hood rely on `Authorization.projects(permission, user)` by checking that the `project_id` attribute of the record is within that set of projects.