Commit Graph
98 Commits
Author SHA1 Message Date
Douwe Maan f9bcb9632c Add specific ability for managing group members 2015-07-28 16:32:15 +02:00
Robert Speicher 31dc5e7034 Add admin_merge_request ability to Developer level and up
This was necessary because this permission is checked dynamically by
`app/views/shared/issuable/_context` when on a Merge Request.

Closes #2058
2015-07-24 14:57:38 -04:00
Stan Hu 996ad35bed Merge branch 'fix-disabled-feature-access' into 'master'
Fix (i.e. prevent) access to disabled features for unauthenticated users

Unauthenticated users had access to disabled features of public
projects. The code has been slightly refactored so that feature checks
are done in a separate method and can also be applied for public access.

See merge request !1006
2015-07-20 16:42:07 +00:00
Daniel Gerhardt 4a0e4c857f Fix access to disabled features for unauthenticated users
Unauthenticated users had access to disabled features of public
projects. The code has been slightly refactored so that feature checks
are done in a separate method and can also be applied for public access.
2015-07-20 09:45:24 +02:00
Daniel Gerhardt 69417d36b2 Fix label read access for unauthenticated users
The label page was added to navigation for unauthorized users because
the previously used milestone read permission was still checked. This
has been fixed and read access to labels is now granted (again) for
public projects.

This regression has been introduced in
07efb17e10 (7.12).

See also 9bcd36396b.

Refs !836, !842.
2015-07-19 21:33:21 +02:00
Dmitriy Zaporozhets a5b54f919a Reporter role can manage issue tracker now
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-30 13:33:02 +02:00
Dmitriy Zaporozhets 7ca017b513 Refactor issue, mr, note abilities to include project abilities too
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-26 18:15:36 +02:00
Dmitriy Zaporozhets 083d4604c4 Change dynamic abilities to new format
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-26 17:18:40 +02:00
Dmitriy Zaporozhets 342d553709 Rename abilities to correspond contoller/model action names
write_ was renamed to create_
modify_  was renamed to update_

So now in update action we have next code

def create
  can?(current_user, :create_issue, @issue)
end

def update
  can?(current_user, :update_issue, @issue)
end

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-26 15:55:56 +02:00
Dmitriy Zaporozhets d5947ada44 Simplify set of assignee, milestone and label to admin_issue rule
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-26 15:45:45 +02:00
Dmitriy Zaporozhets d315d1eba4 Dont allow guest to set assigne, milestone and label when create new issue or merge request
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-25 15:38:04 +02:00
Stan Hu e785b9d2e2 Fix Error 500 when one user attempts to access a personal, internal snippet
Closes #1815
2015-06-19 21:23:46 -07:00
Stan Hu 07efb17e10 Fix 403 Access Denied error messages when accessing Labels section in a project that has MRs disabled but issues enabled
Closes #1813
2015-06-18 03:15:05 -07:00
Stan Hu ab88b7da19 Fix project snippets button appearing when it is disabled
Closes #1705
2015-05-27 05:07:44 -07:00
Stan Hu 9bcd36396b Refactor permission checks to use can? instead of issues_enabled and merge_requests_enabled 2015-05-25 16:51:04 -07:00
Stan Hu a7d8a7bd3d Disable "New Issue" and "New Merge Request" buttons when features are disabled in project settings
Closes #1676
2015-05-25 06:16:33 -04:00
Douwe Maan ff3caad4ca Rename manage_group ability to admin_group for consistency with project. 2015-04-14 12:05:49 +02:00
Dmitriy Zaporozhets 648f38cd98 Merge branch 'fix-restricted-visibility' into 'master'
Restricted visibility levels - bug fix and new feature

This allows admin users to override restricted visibility settings when creating and updating projects and snippets, and moves the restricted visibility configuration from gitlab.yml to the web UI.  See #1903.

## Move configuration location

I added a new section to the application settings page for restricted visibility levels.  Each level has a checkbox, styled with Bootstrap to look like a toggle button.  A checked box means that the level is restricted.  I added a glowing text shadow and changed the background color for checked buttons because the default styles made it hard to distinguish between checked and unchecked.  This image shows the new section with the "Public" box checked:

![restricted_visibility_settings](https://dev.gitlab.org/Okada/gitlabhq/uploads/629562e4313f89b795e81c3bb0f95893/restricted_visibility_settings.png)

## Allow admins to override

To allow admin users to override the restricted visibility levels, I had to remove the `visibility_level` validation from the `Project` class.  The model doesn't know about the `current_user`, which should determine whether the restrictions can be overridden.  We could use the creator in the validation, but that wouldn't work correctly for projects where a non-admin user is the creator and an admin tries to change the project to a restricted visibility level.

The `Project::UpdateService` and `Project::CreateService` classes already had code to determine whether the current user is allowed to use a given visibility level; now all visibility level validation is done in those classes.  Currently, when a non-admin tries to create or update a project using a restricted level, these classes silently set the visibility level to the global default (create) or the project's existing value (update).  I changed this behavior to be more like an Active Model validation, where using a restricted level causes the entire request to be rejected.

Project and personal snippets didn't have service classes, and restricted visibility levels weren't being enforced in the model or the controllers.  The UI disabled radio buttons for restricted levels, but that wouldn't be difficult to circumvent.  I created the `CreateSnippetService` and `UpdateSnippetService` classes to do the same restricted visibility check that the project classes do.  And since I was dealing with snippet visibility levels, I updated the API endpoints for project snippets to allow users to set and update the visibility level.

## TODO

* [x] Add more tests for restricted visibility functionality

cc @sytse @dzaporozhets

See merge request !1655
2015-03-16 17:49:46 +00:00
Douwe Maan 31fc73f0a9 Use project_member instead of team_member. 2015-03-15 13:50:38 +01:00
Douwe Maan 99f995755e Use group_member instead of users_group or membership. 2015-03-15 13:49:41 +01:00
Vinnie Okada 5710c1aaf8 Update snippet authorization
Allow authors and admins to update the visibility level of personal and
project snippets.
2015-03-14 10:30:48 -06:00
Ciro Santilli 33c9f05c6b Append in place for strings and arrays 2015-01-01 21:12:00 +01:00
Ciro Santilli b66a152735 Factor abilities methods
in app controller, user model and services.
2014-10-19 11:12:39 +02:00
Ciro Santilli 2e9f5de868 Add parenthesis to function def with arguments. 2014-10-03 09:18:46 +02:00
Dmitriy Zaporozhets c69b8e0459 Huge replace of old users_project and users_group references
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-09-14 19:32:51 +03:00
Dmitriy Zaporozhets 593df8e69a Improve labels
* allow developers to manage labels
* add ability to remove label

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-07-30 15:15:39 +03:00
Dmitriy Zaporozhets 048a21974e Add create/update to Labels controller
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-07-30 13:12:11 +03:00
Dmitriy Zaporozhets 2099aa38b6 Merge pull request #7131 from skv-headless/per_request_rules_caching
per request project rules caching
2014-07-14 13:58:53 +03:00
skv-headless 8ec02ed9aa per request project rules caching 2014-06-14 14:05:25 +04:00
Dmitriy Zaporozhets eb7845682d Improve files/snippets action buttons
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-06-13 20:21:48 +03:00
Dmitriy Zaporozhets 0fdce4a52b Refactor some search scopes to prevent wierd behaviour and PG::Error issues
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-06-05 20:37:35 +03:00
Dmitriy Zaporozhets c283fba3b7 Improve performance of application for large teams
This commit fixes a lot of sql queries to db for for groups and projects
with big amount of members.

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-06-04 11:52:17 +03:00
Dmitriy Zaporozhets aea79b8035 Add ability rule for creating project in namespace
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-05-28 19:03:01 +03:00
Matt DeTullio 5d6d795d60 Fixes a bug with group member administration
Group owners were not able to remove any users from their group if they were the only owner.
2014-03-10 22:56:26 -04:00
Dmitriy Zaporozhets 645e8d4705 Move services for collecting items to Finders
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-02-25 19:15:08 +02:00
Dmitriy Zaporozhets 5f31caa0ed Fix read_group ability
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-02-25 15:45:19 +02:00
Dmitriy Zaporozhets 75eed4eb83 Implement project collection service
Main purpose is move big amount of methods from user, group, project
models and place filtering logic in one place.
It also fixes 500 error on group page for PostgreSQL

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-02-25 14:36:36 +02:00
Jason Hollingsworth 2f69213e3f Allow access to groups with public projects.
Fixed Group avatars to only display when user has read
permissions to at least one project in the group.
2014-02-20 09:26:38 -06:00
Ciro Santillli 439a61783d User can leave group from group page. 2014-02-12 15:52:53 +01:00
Dmitriy Zaporozhets 58ac731c37 Fix Issues#bulk_update
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-02-10 15:36:58 +02:00
Dmitriy Zaporozhets 4645f464a3 Allow developers to mange issue tracker
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-01-24 21:29:22 +02:00
Steven Thonus 37383966ef Archiving old projects; archived projects aren't shown on dashboard
features for archive projects
abilities for archived project
other abilities for archive projects

only limit commits and merges for archived projects

ability changed to prohibited actions on archived projects

added spec and feature tests for archive projects

changed search bar not to include archived projects
2013-12-16 14:39:14 +01:00
Jason Hollingsworth d9bb4230cc Adding authenticated public mode (internal).
Added visibility_level icons to project view (rather than just text).
Added public projects to search results.
Added ability to restrict visibility levels standard users can set.
2013-11-26 22:22:07 -06:00
Dmitriy Zaporozhets 65b9768ccf Group ownership completely based on users_groups relation now
Before we have only owner_id to determine group owner
With multiple owners per group we should get rid of owner_id in group.
So from now @group.owner will always be nil but
@group.owners return an actual array of users who can admin this group
2013-09-26 14:49:22 +03:00
Dmitriy Zaporozhets 573d367be5 Modify permissions for project and group
* Hooks and team pages allowed only for masters/owners
* Group page allowed for admin
* Corrent authentication for Projects controller
* Hide some project elements from visitor
2013-09-25 14:05:35 +03:00
Dmitriy Zaporozhets d90462033e Remove writing issues/notes from non-auth user abilities 2013-09-24 22:13:28 +03:00
Dmitriy Zaporozhets 66998f6d46 Allow non authenticated user access to public projects 2013-09-24 15:58:39 +03:00
Dmitriy Zaporozhets 694768e518 Fix 404 if Group guest visit empty group page 2013-09-11 21:00:16 +03:00
Dmitriy Zaporozhets 9fbbd6a68e Return empty abilities if user is blocked 2013-08-27 12:41:49 +03:00
Dmitriy Zaporozhets e8e9e0f771 Use own abilities for namespace class 2013-06-21 22:44:40 +03:00