Commit graph

12 commits

Author SHA1 Message Date
Rémy Coutable
ec0061a95c Allow Member.add_user to handle access requesters
Changes include:

- Ensure Member.add_user is not called directly when not necessary
- New GroupMember.add_users_to_group to have the same abstraction level as for Project
- Refactor Member.add_user to take a source instead of an array of members
- Fix Rubocop offenses
- Always use Project#add_user instead of project.team.add_user
- Factorize users addition as members in Member.add_users_to_source
- Make access_level a keyword argument in GroupMember.add_users_to_group and ProjectMember.add_users_to_projects
- Destroy any requester before adding them as a member
- Improve the way we handle access requesters in Member.add_user
  Instead of removing the requester and creating a new member,
  we now simply accepts their access request. This way, they will
  receive a "access request granted" email.
- Fix error that was previously silently ignored
- Stop raising when access level is invalid in Member, let Rails validation do their work

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-09-28 09:43:00 +02:00
Ahmad Sherif
be870760d5 Add a spec for ProjectsFinder project_ids_relation option
Follow-up 1003454c
2016-08-15 12:49:31 +02:00
Ahmad Sherif
e93de6066b Fix ProjectsFinder spec
Follow-up on 1003454c
2016-08-15 12:49:31 +02:00
Douwe Maan
31266c5be4 Address feedback 2016-03-22 00:09:20 +01:00
Felipe Artur
8b830b8c3b Fix specs 2016-03-18 21:04:53 -03:00
Dmitriy Zaporozhets
55ceda1204
Bring shared project feature tests from EE
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-03-12 14:45:14 +01:00
Yorick Peterse
fed059a12d Port GitLab EE ProjectsFinder changes
These changes were added in GitLab EE commit
d39de0ea91b26b8840195e5674b92c353cc16661. The tests were a bit bugged
(they used a non existing group, thus not testing a crucial part) which
I only noticed when porting CE changes to EE.
2015-11-20 15:53:04 +01:00
Yorick Peterse
fbcf3bd3fc Refactor ProjectsFinder to not pluck IDs
This class now uses a UNION (when needed) instead of plucking tens of
thousands of project IDs into memory. The tests have also been
re-written to ensure all different use cases are tested properly
(assuming I didn't forget any cases).

The finder has also been broken up into 3 different finder classes:

* ContributedProjectsFinder: class for getting the projects a user
  contributed to.
* PersonalProjectsFinder: class for getting the personal projects of a
  user.
* ProjectsFinder: class for getting generic projects visible to a given
  user.

Previously a lot of the logic of these finders was handled directly in
the users controller.
2015-11-18 13:05:45 +01:00
Robert Speicher
fb6dc1f07d Add Group#add_* convenience methods
Encapsulates the logic for `Gitlab::Access::WHATEVER` levels.
2015-08-07 00:20:02 -04:00
Jeroen van Baarsen
0c4a70a306 Updated rspec to rspec 3.x syntax
Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
2015-02-12 19:17:35 +01:00
Robert Speicher
1897fb00b8 Make use of project factory traits 2014-03-19 05:15:24 -04:00
Dmitriy Zaporozhets
345b3d4b72
Update tests and fix Finders readme
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-02-25 19:21:53 +02:00
Renamed from spec/services/projects_collect_service_spec.rb (Browse further)