Content
View differences
Updated by Klaus Zanders almost 3 years ago
To allow users or groups and users to be added to single work packages, packages as contributors, we can extend the existing need to establish a new membership system that allows this. The current `members` system to not table only allow linking supports adding users to a project, but also to a specific work package. whole projects.
* The relation should be mutually exclusive (a membership can either be to [ ] Create a project or to a work package, never both).
new table that links WorkPackages with users and allows assigning **one** role for that member
* For this we can either make [ ] Change the relationship between members and project/work package into a polymorphic relationship. This would make `JOIN` queries more complicated, but would simplify the modeling `visible` scope of the relation
* Another option would be, WorkPackages to add a `work_package_id` field to also include those, where the `members` table, and then adding a CONSTRAINT in the database, that prevents both columns requested user is either able to be filled. Additionally we can add a rails validation. The CONSTRAINT on view the DB level would be benefitial in my eyes, WP because we do write of project membership queries directly to or direct WP membership
~~Extending the DB, current~~ `~~members~~` ~~relation is not really an option, as it does not support polymorphism and thus we changing that would need another security layer instead of only relying on AR:
```sql
ALTER TABLE members
ADD CONSTRAINT either_member_of_work_package_or_project CHECK (num_nulls(work_package_id, project_id) >= 1);
```
* The current permission checking system only works on `project` level. The `user.allowed_to?` method needs to be extended to allow passing in a project or a work package.
* When a work package permission is requested, the code needs really big data model change. Also, it supports assigning multiple roles to check if the permission is granted either through the project or directly on the work package. As work package permissions might elevate the users permissions on a specific work package, we always have to check both paths.
* When a project membership, that is given, the test should stay as it something that is right now.
* Copying a work package, or copying not needed for the entire project should ensure that all memberships are correctly copied over WP memberships~~
* The relation should be mutually exclusive (a membership can either be to
* Another option would be,
~~Extending
```sql
ALTER TABLE members
ADD CONSTRAINT either_member_of_work_package_or_project CHECK (num_nulls(work_package_id, project_id) >= 1);
```
* The current permission checking system only works on `project` level. The `user.allowed_to?` method needs to be extended to allow passing in a project or a work package.
* When a work package permission is requested, the code needs
* When a project
* Copying a work package, or copying