Files
gitlabhq/doc
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
..
2015-03-01 12:02:12 +00:00
2015-01-06 11:50:05 +01:00
2015-02-24 20:36:11 +02:00
2015-02-18 22:07:09 -08:00

Documentation

User documentation

  • API Automate GitLab via a simple and powerful API.
  • Markdown GitLab's advanced formatting system.
  • Permissions Learn what each role in a project (guest/reporter/developer/master/owner) can do.
  • Project Services Integrate a project with external services, such as CI and chat.
  • Public access Learn how you can allow public and internal access to projects.
  • SSH Setup your ssh keys and deploy keys for secure access to your projects.
  • Web hooks Let GitLab notify you when new code has been pushed to your project.
  • Workflow Using GitLab functionality and importing projects from GitHub and SVN.
  • GitLab as OAuth2 authentication service provider. It allows you to login to other applications from GitLab.

Administrator documentation

  • Install Requirements, directory structures and installation from source.
  • Integration How to integrate with systems such as JIRA, Redmine, LDAP and Twitter.
  • Raketasks Backups, maintenance, automatic web hook setup and the importing of projects.
  • Custom git hooks Custom git hooks (on the filesystem) for when web hooks aren't enough.
  • System hooks Notifications when users, projects and keys are changed.
  • Security Learn what you can do to further secure your GitLab instance.
  • Update Update guides to upgrade your installation.
  • Welcome message Add a custom welcome message to the sign-in page.
  • Issue closing Customize how to close an issue from commit messages.
  • Libravatar Use Libravatar for user avatars.
  • Operations Keeping GitLab up and running
  • Log system Log system

Contributor documentation

  • Development Explains the architecture and the guidelines for shell commands.
  • Legal Contributor license agreements.
  • Release How to make the monthly and security releases.