summaryrefslogtreecommitdiff
path: root/app/models/namespace.rb
Commit message (Collapse)AuthorAgeFilesLines
* Implement final review comments from @DouweM and @rymaiTimothy Andrew2017-02-241-1/+1
| | | | | | | | | | | | | | - Have `Uniquify` take a block instead of a Proc/function. This is more idiomatic than passing around a function in Ruby. - Block a user before moving their issues to the ghost user. This avoids a data race where an issue is created after the issues are migrated to the ghost user, and before the destroy takes place. - No need to migrate issues (to the ghost user) in a transaction, because we're using `update_all` - Other minor changes
* Extract code from `Namespace#clean_path` for ghost user generation.Timothy Andrew2017-02-241-8/+2
| | | | | | | | | | 1. Create a `Uniquify` class, which generalizes the process of generating unique strings, by accepting a function that defines what "uniqueness" means in a given context. 2. WIP: Make sure tests for `Namespace` pass, add more if necessary. 3. WIP: Add tests for `Uniquify`
* Fix a number of race conditions that can occur during namespace deletionsh-namespace-cleanup-deleted-projectsStan Hu2017-02-151-2/+10
| | | | | | | | | | | | | | | | | | There are two problems in the current implementation: 1. If a project is marked for deletion via the `pending_delete` flag and then the namespace was quickly deleted, it's possible that the namespace skips over that project and leaves that project in an orphaned state. 2. Before namespace deletion, the namespace attempts to clean up all the relevant storage paths. However, if all projects have been removed synchronously, then the namespace will not be able to clean anything. To prevent this, we should load the paths to be deleted before actually destroying projects. The specs were missing this second case due to a permission issue that caused project removal never to happen.
* Merge branch 'dz-refactor-full-path' into 'master' Dmitriy Zaporozhets2017-02-081-21/+4
|\ | | | | | | | | Store group and project full name and full path in routes table See merge request !8979
| * Store group and project full name and full path in routes tabledz-refactor-full-pathDmitriy Zaporozhets2017-02-081-21/+4
| | | | | | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* | Merge branch 'dz-limit-nested-groups' into 'master' Douwe Maan2017-02-081-1/+14
|\ \ | |/ |/| | | | | Limit level of nesting for groups See merge request !9000
| * Limit level of nesting for groupsdz-limit-nested-groupsDmitriy Zaporozhets2017-02-081-1/+14
| | | | | | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* | Refresh authorizations when transferring projectsrefresh-permissions-when-moving-projectsYorick Peterse2017-02-071-0/+4
|/ | | | | | | | This ensures that project authorizations are refreshed when moving a project from one namespace to another. When doing so the permissions for all users of both the old and new namespaces are refreshed. See #26194 for more information.
* Rename pages namespace or project path when changedKamil Trzcinski2017-01-311-0/+1
| | | | - Move UploadsTransfer to ProjectTransfer and inherit from this to UploadsTransfer and PagesTransfer
* Merge branch 'backport-ee-changes-for-build-minutes' into 'master' Grzegorz Bizon2017-01-251-0/+5
|\ | | | | | | | | Backport changes introduced by https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/1078 See merge request !8657
| * Merge remote-tracking branch 'origin/master' into ↵Kamil Trzcinski2017-01-241-0/+20
| |\ | | | | | | | | | backport-ee-changes-for-build-minutes
| * | Backport changes introduced by ↵Kamil Trzcinski2017-01-201-0/+5
| | | | | | | | | | | | https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/1083
* | | Merge branch 'dz-nested-groups-access-improvements' into 'master' Dmitriy Zaporozhets2017-01-251-2/+20
|\ \ \ | |_|/ |/| | | | | | | | Nested groups feature improvemetns See merge request !8448
| * | Add User#nested_groups and User#nested_projects methodsDmitriy Zaporozhets2017-01-251-2/+2
| | | | | | | | | | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
| * | Refactor Namespace code related to nested groupsDmitriy Zaporozhets2017-01-131-2/+20
| |/ | | | | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* | Merge branch 'fix/rename-group-export-vuln' into 'security' Robert Speicher2017-01-231-0/+20
|/ | | | | Fix export files not removed when a user takes over a namespace See merge request !2051
* Add more storage statisticsMarkus Koller2016-12-211-0/+13
| | | | | | | | | | | | | This adds counters for build artifacts and LFS objects, and moves the preexisting repository_size and commit_count from the projects table into a new project_statistics table. The counters are displayed in the administration area for projects and groups, and also available through the API for admins (on */all) and normal users (on */owned) The statistics are updated through ProjectCacheWorker, which can now do more granular updates with the new :statistics argument.
* Fix error 500 renaming group. Also added specs and changelog.James Lopez2016-12-201-2/+2
|
* Merge branch 'dz-nested-groups-title-ui' into 'master' Sean McGivern2016-12-161-0/+13
|\ | | | | | | | | UI improvements for nested group feature See merge request !8062
| * Refactor Namespace#parents methoddz-nested-groups-title-uiDmitriy Zaporozhets2016-12-151-11/+1
| | | | | | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
| * Add parents method to NamespaceDmitriy Zaporozhets2016-12-131-5/+20
| | | | | | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
| * Show full path for nested groups at dashboard groups listDmitriy Zaporozhets2016-12-131-0/+8
| | | | | | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* | Modify namespace name and path validationdz-remove-namespaces-path-uniqDmitriy Zaporozhets2016-12-121-2/+1
|/ | | | | | | | | | | Currently namespace name and path have uniq validaiton which does not allow us to use same group name/path inside different groups. This commit changes validation in next way: * Allow same namespace name with different parent_id * Allow same namespace path. Uniq validation should be handled by routes table Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* Merge branch 'dz-nested-groups' into 'master' Douwe Maan2016-12-091-1/+17
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add nested groups support on data level ## What does this MR do? - [x] Add `parent_id` field to `Namespace`model. - [x] Create new database table `routes` that keeps information about full path to each group or project - [x] Remove uniq index from `namespaces.path` - [x] Add uniq index on `routes.path` - [x] Fill routes table with path data from namespaces and projects - [x] Change Namespace/Project URL lookup by routes table - [x] Rename related routes (nested groups, projects) when parent path changes This is solely backend preparation. UI, Permissions and API support will be added in separate merge request. ## Are there points in the code the reviewer needs to double check? migrations, Route model, Routable concern Will require downtime. See https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7121#note_19490281 discussion ## Why was this MR needed? One step further to full nested groups support ## Screenshots (if relevant) No UI changes in this merge request so far ## Does this MR meet the acceptance criteria? - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG.md) entry added~~ - ~~[Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~ - ~~API support added~~ - Tests - [x] Added for this feature/bug - [x] All builds are passing - [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html) - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] Branch has no merge conflicts with `master` (if it does - rebase it please) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) ## What are the relevant issue numbers? https://gitlab.com/gitlab-org/gitlab-ce/issues/2772 See merge request !7121
| * Add nested groups support on data leveldz-nested-groupsDmitriy Zaporozhets2016-12-081-1/+17
| | | | | | | | | | | | | | | | * add parent_id field to namespaces table to store relation with nested groups * create routes table to keep information about full path of every group and project * project/group lookup by full path from routes table Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* | Use :maximum instead of :within for length validators with a 0..N range25209-improve-length-validatorsRémy Coutable2016-12-061-7/+7
|/ | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* Merge branch 'mrchrisw/add-namespace-logging' into 'master' Robert Speicher2016-11-241-0/+2
|\ | | | | | | | | | | | | Log mv_namespace parameters [ci skip] See merge request !7729
| * Log mv_namespace parametersmrchrisw/add-namespace-loggingChris Wilson2016-11-241-0/+2
| |
* | Update user's authorized projects if project is allowed to share with groupAhmad Sherif2016-11-231-0/+8
|/
* Correct namespace validation to forbid bad names #21077Will Starms2016-10-071-8/+6
| | | | | | Adds .git and .atom to the master namespace regex Updates existing group tests and adds two new ones Updates path cleaning to also forbid .atom
* Add markdown cache columns to the database, but don't use them yetNick Thomas2016-10-071-0/+3
| | | | | | | | | | | | This commit adds a number of _html columns and, with the exception of Note, starts updating them whenever the content of their partner fields changes. Note has a collision with the note_html attr_accessor; that will be fixed later A background worker for clearing these cache columns is also introduced - use `rake cache:clear` to set it off. You can clear the database or Redis caches separately by running `rake cache:clear:db` or `rake cache:clear:redis`, respectively.
* Added group-specific setting for LFS.Patricio Cano2016-09-151-0/+5
| | | | Groups can enable/disable LFS, but this setting can be overridden at the project level. Admin only
* Fix bug where destroying a namespace would not always destroy projectsStan Hu2016-08-111-0/+2
| | | | | | | | | | | | | | | | | | | There is a race condition in DestroyGroupService now that projects are deleted asynchronously: 1. User attempts to delete group 2. DestroyGroupService iterates through all projects and schedules a Sidekiq job to delete each Project 3. DestroyGroupService destroys the Group, leaving all its projects without a namespace 4. Projects::DestroyService runs later but the can?(current_user, :remove_project) is `false` because the user no longer has permission to destroy projects with no namespace. 5. This leaves the project in pending_delete state with no namespace/group. Projects without a namespace or group also adds another problem: it's not possible to destroy the container registry tags, since container_registry_path_with_namespace is the wrong value. The fix is to destroy the group asynchronously and to run execute directly on Projects::DestroyService. Closes #17893
* Refactor repository paths handling to allow multiple git mount pointsAlejandro Rodríguez2016-06-291-40/+55
|
* Merge branch 'docker-registry' into docker-registry-viewKamil Trzcinski2016-05-131-17/+0
|\
| * Remove the annotate gem and delete old annotationsJeroen van Baarsen2016-05-091-17/+0
| | | | | | | | | | | | | | | | | | In 8278b763d96ef10c6494409b18b7eb541463af29 the default behaviour of annotation has changes, which was causing a lot of noise in diffs. We decided in #17382 that it is better to get rid of the whole annotate gem, and instead let people look at schema.rb for the columns in a table. Fixes: #17382
* | Fix specsKamil Trzcinski2016-05-131-1/+1
| |
* | Fix CI testsKamil Trzcinski2016-05-121-1/+1
| |
* | Block renaming project or repository if it has container registry tagsKamil Trzcinski2016-05-091-0/+8
|/
* Annotate the modelsZeger-Jan van de Weg2016-05-061-9/+11
|
* Make Namespace.search case-insensitiveYorick Peterse2016-03-111-1/+11
| | | | | This ensures searching namespaces works exactly the same as searching for any other resource.
* Annotate modelsStan Hu2016-01-061-1/+0
|
* Fixed Rubocop offensesGabriel Mazetto2015-12-151-2/+2
|
* Add custom NamespaceNameValidatorRobert Speicher2015-12-071-3/+3
|
* Add custom NamespaceValidatorRobert Speicher2015-12-071-5/+3
|
* Annotate modelsDmitriy Zaporozhets2015-11-131-0/+1
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* Fix: Images cannot show when projects' path was changeduploads_path_fixValery Sizov2015-10-141-0/+2
|
* Note the original location of a moved project when notifying users of the moveproject_movingValery Sizov2015-10-011-1/+3
|
* Revert "Merge branch 'revert-satellites' into 'master' "Dmitriy Zaporozhets2015-08-111-3/+2
| | | | | This reverts commit 5daf44b7c86e0e2641a902b1da8b01d91fa3dbfa, reversing changes made to 2f706fbd231cabe7a76a5d17ac44285aaaf8592c.
* Revert "Merge branch 'drop-satellites'"Dmitriy Zaporozhets2015-08-111-2/+3
| | | | | | | This reverts commit 957e849f41d96fa9778fcdd06792d2f0274b29ab, reversing changes made to 6b9dbe9f5a175a8162abf296367f561bab3eea1a. Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>