Commit Graph

192 Commits

Author SHA1 Message Date
Stan Hu 871723da7f Incorporate review comments 2016-07-26 16:53:39 -07:00
Stan Hu d1ea2bca61 Optimize maximum user access level lookup in loading of notes
NotesHelper#note_editable? and ProjectTeam#human_max_access currently
take about 16% of the load time of an issue page. This MR preloads
the maximum access level of users for all notes in issues and merge
requests with several queries instead of one per user and caches
the result in RequestStore.
2016-07-26 15:33:05 -07:00
Rémy Coutable 5fb436aaa4 Fix a few nitpicks
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-07-20 14:38:21 +02:00
Felipe Artur 4d69cb9d94 Allow to disable user request access to groups/projects 2016-07-20 14:38:21 +02:00
Kamil Trzcinski 1744c742f2 Allow to access Container Registry for Public and Internal projects 2016-07-15 17:05:41 +02:00
Rémy Coutable 19b80e8252
Add a migration to remove requesters that are owners of their project
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-07-05 18:55:35 +02:00
Rémy Coutable 9ea80a196f
Fix condition in Ability and start with cheaper checks
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-07-05 16:58:27 +02:00
Rémy Coutable 22ba5d8a7f
New :request_access ability to replace a ugly helper
- Group / project members cannot request access
- Group members cannot request access to a group's project

This addresses an issue where project owners could request access
to their own project, leading to UI inconsistency where their requester
status would replace their owner status.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-07-05 14:35:26 +02:00
Lin Jen-Shin 63477fd27f Disable Metrics/CyclomaticComplexity for Ability.allowed
There's little point to cut that down.
2016-06-30 21:38:29 +08:00
Lin Jen-Shin 23a3ce946a Use Ability to check pre-requisite. Change back to 403 because:
If we're using `can?` it would look weird to use 409
2016-06-29 19:04:06 +08:00
Kamil Trzcinski aa05fbc05d Fix 404 for pipelines 2016-06-23 16:47:03 +02:00
Rémy Coutable be09845914 Merge branch 'environments-and-deployments' into 'master'
Add environments and deployments

This MR is a continuation of https://gitlab.com/gitlab-org/gitlab-ce/issues/17009.

The current implementation is as follow:
1. We have two new tables: `environments` and `deployments`.
2. We have a new tab: `Environments` under `Pipelines` where you can see all you environments and add a new one.
3. We add a new option to `.gitlab-ci.yml` to track where we should create a deployment for environment.
4. If environment in `.gitlab-ci.yml` is specified it will create a deployment. **If environment does not exist it will be created.** (this got changed)
5. The deployment is always successful and shows the time of the action, in that case a build that presumably should do deployment. In the future we could extend deployment with statuses: success, failure. We could extend deployments with information that this is partial or full deployment.
6. User have to create environments that he will track first.
7. User can remove environments.
8. User can retry/rollback past deployment (in that case we retry past build). The new build when succeeds it will create a new deployment.
9. Currently environment have only one parameter: `name`. In the future it should have: `variables`, `credentials` and possibly `runners` and maybe other resources.
10. Currently deployment have this parameters: `sha`, `ref`, `deployable (in this case a build)`, `user (who triggered a deployment)`, `created_at`.

The `.gitlab-ci.yml`:
```
deploy to production:
  stage: deploy
  script: dpl travis...
  environment: production
```

What needs to be done:
- [x] Write initial implementation
- [x] Improve implementation (@ayufan)
- [x] Write tests (@ayufan)
- [x] Improve UX of the forms (cc @markpundsack) - reviewed by @markpundsack
- [x] Improve implementation of the views (cc @jschatz1) - done by @iamphill 
- [x] Write .gitlab-ci.yml documentation for `environments` - done by @ayufan
- [ ] Write user documentation (@ayufan and @markpundsack)

See merge request !4605
2016-06-15 13:48:09 +00:00
Kamil Trzcinski eb26755d63 Create_deployment ability is need to create retry or rollback deployment 2016-06-15 12:56:02 +02:00
Kamil Trzcinski 18fd2ccb8b Improve cyclomatic of ability::allowed 2016-06-15 12:12:26 +02:00
Kamil Trzcinski 0052644009 Improve forms and specs 2016-06-15 12:07:06 +02:00
Kamil Trzcinski 14a02a6a95 Improve design after review 2016-06-14 18:34:48 +02:00
Rémy Coutable 515205d3c1 UI and copywriting improvements
+ Move 'Edit Project/Group' out of membership-related partial
+ Show the access request buttons only to logged-in users
+ Put the request access buttons out of in a more visible button
+ Improve the copy in the #remove_member_message helper

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-06-14 13:18:14 +02:00
Rémy Coutable d26f81239a Add request access for groups
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-06-14 13:07:26 +02:00
Kamil Trzcinski 7d9e8b04c0 Merge remote-tracking branch 'origin/master' into environments-and-deployments 2016-06-14 12:41:18 +02:00
David Alexander 17c22156c5 Initial implementation of user access request to projects 2016-06-14 12:12:02 +02:00
Douglas Barbosa Alexandre b56c456750 Project members with guest role can't access confidential issues 2016-06-13 19:32:00 -03:00
Kamil Trzcinski 907c0e6796 Added initial version of deployments 2016-06-10 23:36:54 +02:00
Douwe Maan 2d084dd848 Merge branch 'separate-banzai-references' into 'master'
Separate reference gathering from rendering

This is a required step to allow batch processing when gathering references. This in turn would allow grabbing (for example) all mentioned users of an issue/merge request using a single query.

cc @rspeicher @DouweM 

See merge request !3969
2016-06-01 15:51:59 +00:00
Yorick Peterse 580d250166
Refactor Participable
There are several changes to this module:

1. The use of an explicit stack in Participable#participants
2. Proc behaviour has been changed
3. Batch permissions checking

== Explicit Stack

Participable#participants no longer uses recursion to process "self" and
all child objects, instead it uses an Array and processes objects in
breadth-first order. This allows us to for example create a single
Gitlab::ReferenceExtractor instance and pass this to any Procs. Re-using
a ReferenceExtractor removes the need for running potentially many SQL
queries every time a Proc is called on a new object.

== Proc Behaviour Changed

Previously a Proc in Participable was expected to return an Array of
User instances. This has been changed and instead it's now expected that
a Proc modifies the Gitlab::ReferenceExtractor passed to it. The return
value of the Proc is ignored.

== Permissions Checking

The method Participable#participants uses
Ability.users_that_can_read_project to check if the returned users have
access to the project of "self" _without_ running multiple SQL queries
for every user.
2016-06-01 16:22:35 +02:00
Grzegorz Bizon 86cf9dd253 Enable Lint/LiteralInCondition rubocop cop
Checks of literals used in conditions.

See #17478
2016-05-30 12:34:25 +02:00
Kamil Trzcinski cd26cfbc27 Allow anonymous user to access pipelines 2016-05-23 01:31:51 +02:00
Kamil Trzcinski d0eb9438e9 Merge remote-tracking branch 'origin/master' into with-pipeline-view 2016-05-16 17:13:14 -05:00
Kamil Trzcinski f4f9184a01 Rename JWT to JSONWebToken 2016-05-14 18:23:31 -05:00
Kamil Trzcinski 715a8cfa2f Fix authentication service 2016-05-14 14:27:56 -05:00
Kamil Trzcinski 0094d8f196 Rename `images` to `container_registry` 2016-05-09 20:29:57 +03:00
Kamil Trzcinski f41a3e24d2 Added authentication service for docker registry 2016-04-29 16:45:00 +02:00
Kamil Trzcinski cb90368a69 Merge remote-tracking branch 'origin/master' into with-pipeline-view 2016-04-26 16:36:17 +02:00
Felipe Artur 820c08cefd Fix documentation and improve permissions code 2016-04-18 11:12:28 -03:00
Felipe Artur 09c8cf9de6 Remove group members check 2016-04-18 11:12:28 -03:00
Felipe Artur ce96d482d9 Insert users check into api 2016-04-18 11:12:27 -03:00
Felipe Artur 07b38c3b38 Code fixes 2016-04-18 11:12:27 -03:00
Felipe Artur 147879ae66 Fix specs 2016-04-18 11:12:27 -03:00
Felipe Artur e8a77c0aee Fix code 2016-04-18 11:12:27 -03:00
Felipe Artur 668d6ffa43 Add specs and fix code 2016-04-18 11:12:27 -03:00
Felipe Artur 57519565f1 Move verification to abilities 2016-04-18 11:12:27 -03:00
Kamil Trzcinski e84c155f09 WIP 2016-04-13 11:03:39 +02:00
Rémy Coutable 4f07c0a107 Ensure project snippets have their own access level 2016-03-25 18:51:17 +01:00
Rémy Coutable f4bdefdff1 Ensure private project snippets are not viewable by unauthorized people
Fix https://gitlab.com/gitlab-org/gitlab-ce/issues/14607.
2016-03-25 12:33:42 +01:00
Douwe Maan 31266c5be4 Address feedback 2016-03-22 00:09:20 +01:00
Douwe Maan ae7b2ef62c Merge branch 'master' into issue_12658
# Conflicts:
#	app/models/issue.rb
#	app/views/projects/_home_panel.html.haml
#	app/views/shared/projects/_project.html.haml
#	db/schema.rb
#	spec/models/project_spec.rb
2016-03-21 23:22:21 +01:00
Zeger-Jan van de Weg 3b088fc5b5 Minor improvements on IssuableActions 2016-03-21 16:59:35 +01:00
Douwe Maan 8db1292139 Tweaks, refactoring, and specs 2016-03-20 21:04:07 +01:00
Douwe Maan 2eb19ea3ea Merge branch 'master' into issue_12658 2016-03-20 14:57:25 +01:00
Zeger-Jan van de Weg 7342a4566c Dry destroy action on issuables 2016-03-19 21:24:05 +01:00
Zeger-Jan van de Weg b959ae553b Improve group visibility level feature 2016-03-18 16:58:04 -03:00