| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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:

## 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
|
| |\
| | |
| | |
| | |
| | | |
Conflicts:
db/schema.rb
|
| | |
| | |
| | |
| | | |
Bug fixes and new tests for the restricted visibility changes.
|
| | |
| | |
| | |
| | |
| | |
| | | |
Add new service classes to create and update project and personal
snippets. These classes are responsible for enforcing restricted
visibility settings for non-admin users.
|
| | |
| | |
| | |
| | |
| | | |
Allow admins to use restricted visibility levels when creating or
updating projects.
|
| | | |
|
| |/
|/| |
|
|/
|
|
|
|
|
| |
Ruby str_equal uses memcmp internally to compare String.
Memcmp is vunerable to timing attacks because it returns early
on mismatch (on most x32 platforms memcmp uses a bytewise comparision).
Devise.secure_compare implements a constant time comparision instead.
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Don't leak information about private project existence via Git-over-SSH/HTTP.
Fixes #2040 and https://gitlab.com/gitlab-org/gitlab-ce/issues/343.
Both `Grack::Auth` (used by Git-over-HTTP) and `Api::Internal /allowed` (used by gitlab-shell/Git-over-SSH) now return a generic "Not Found" error when the project exists but the user doesn't have access to it.
See merge request !1578
|
| | |
|
| | |
|
|\ \
| |/
|/| |
Expose avatar_url in projects API
|
| |
| |
| |
| |
| |
| | |
* Impl Project#avatar_url
* Refactor ApplicationHelper: Use Project#avatar_url
* Update changelog
|
|\ \
| |/
| |
| |
| | |
Conflicts:
lib/api/users.rb
|
| |
| |
| |
| |
| | |
Give more specific errors in API responses and web UI flash messages
when a file update fails.
|
| | |
|
| |
| |
| |
| | |
logs with 404 errors :(
|
| | |
|
| |
| |
| |
| |
| | |
Add an API endpoint to update the access level of an existing group
member.
|
| | |
|
| |
| |
| |
| | |
requests
|
| | |
|
| |\
| | |
| | | |
Added a way to retrieve MR files
|
| | |
| | |
| | |
| | | |
Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
|
| |\ \
| | | |
| | | | |
Access groups using path
|
| | | | |
|
| | | | |
|
| | | | |
|
| |/ / |
|
| |/ |
|
| |\
| | |
| | |
| | |
| | | |
jubianchi/issues/6289-api-handle-error-project-repo
Handle errors on API when a project does not have a repository
|
| | | |
|
| |\ \
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
API: Implement edit via API for projects
I've picked up https://github.com/gitlabhq/gitlabhq/pull/8055 fixed the few hound warnings and replaced all double quotes in the spec file where possible.
# From the original PR:
Implements edit via API for projects. Edit was part of missing features in feature request Full CRUD operations via API for projects.
http://feedback.gitlab.com/forums/176466-general/suggestions/3904506-full-crud-operations-via-api-for-projects
Feature is implemented using existing UpdateService for projects. Permission to change visibility level and name are checked in addition to check for permission to administer project.
Doesn't allow updating project namespace id, because there was existing API-method for transferring project to a group.
Documentation added to doc/api/projects.md. Uses API request PUT /projects/:id .
Tests included for:
1. Success for changing path
2. Success for changing name
3. Success for changing visibility level
4. Success for changing all other attributes
5. Success for changing name & path to existing name & path but in different namespace
6. Failure if not authenticated
7. Failure if path exists in project's namespace
8. Failure if name exists in project's namespace
9. Failure if not sufficient permission to change name
10. Failure if not sufficient permission to change visibility level
11. Failure if not sufficient permission to change other attributes
Allows updating following parameters:
* name
* path
* visibility_level
* public
* default_branch
* issues_enabled
* wiki_enabled
* snippets_enabled
* merge_requests_enabled
* description
See merge request !310
|
| | | | |
|
| | | | |
|
| |/ / |
|
| |/ |
|
| |\
| | |
| | | |
Add description attribute to group API (GET and POST)
|
| | | |
|
| |\ \
| | |/
| |/| |
Typo in project API events comment
|
| | | |
|
| |\ \
| | | |
| | | | |
Replace regex methods by string ones since faster and more readable
|
| | | |
| | | |
| | | |
| | | | |
and more readable.
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | | |
|