summaryrefslogtreecommitdiff
path: root/spec/models/namespace_spec.rb
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'master' into sh-security-fix-backports-masterStan Hu2017-10-171-0/+14
|\
| * Merge branch 'master' into bvl-group-treesBob Van Landuyt2017-10-101-13/+38
| |\
| * | Move the `ancestors_upto` to `Project` and `Namespace`Bob Van Landuyt2017-10-101-0/+14
| | |
* | | Merge branch 'security-10-1' into '10-1-stable'Jen-Shin Lin2017-10-171-10/+4
| |/ |/| | | | | | | Security fixes for 10.1 RC See merge request gitlab/gitlabhq!2209
* | Find forks within users/namespaces using fork membershipsBob Van Landuyt2017-10-071-0/+23
| |
* | Fix namespace deletion testsZeger-Jan van de Weg2017-10-051-13/+15
|/
* Merge branch 'improve-share-locking-feature-for-subgroups' into 'master'Douwe Maan2017-09-071-0/+112
|\ | | | | | | | | | | | | Improve "Share with group lock" feature for subgroups Closes #30550 See merge request !13944
| * Refer to “Share with group lock” consistentlyimprove-share-locking-feature-for-subgroupsMichael Kozono2017-09-061-21/+21
| |
| * Refactor based on code reviewMichael Kozono2017-09-061-3/+3
| |
| * Specify nested_groups specsMichael Kozono2017-09-061-1/+1
| |
| * Enable share_with_group_lock on subgroupMichael Kozono2017-09-061-0/+112
| | | | | | | | …when needed
* | Removes default scope from sortable23079-remove-default-scope-in-sortableTiago Botelho2017-09-071-1/+1
|/
* Speed up Group#user_ids_for_project_authorizationsNick Thomas2017-08-141-0/+30
|
* Change all `:empty_project` to `:project`rs-empty_project-defaultRobert Speicher2017-08-021-3/+3
|
* Use described_class when possibleRémy Coutable2017-07-271-7/+7
| | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* Remove superfluous lib: true, type: redis, service: true, models: true, ↵Rémy Coutable2017-07-271-3/+3
| | | | | | services: true, no_db: true, api: true Signed-off-by: Rémy Coutable <remy@rymai.me>
* Allow groups with the name systembvl-free-system-namespaceBob Van Landuyt2017-07-181-1/+1
|
* Promote visibility level helpers from Group to NamespaceNick Thomas2017-07-171-0/+8
| | | | | In EE, we make use of `namespace#public?` in projects. When the project is in a personal namespace, this breaks as the `public?` helper isn't present.
* Defer project destroys within a namespace in ↵Stan Hu2017-06-291-0/+11
| | | | | | | | | | | Groups::DestroyService#async_execute Group#destroy would actually hard-delete all associated projects even though the acts_as_paranoia gem is used, preventing Projects::DestroyService from doing any work. We first noticed this while trying to log all projects deletion to the Geo log.
* Add "members_count" and "parent_id" data on namespaces APIOswaldo Ferreira2017-06-281-0/+19
|
* Enable Style/DotPosition Rubocop :cop:Grzegorz Bizon2017-06-211-2/+2
|
* Bring in security changes from the 9.2.5 releaseDJ Mountney2017-06-071-2/+8
| | | | | | | | | | | | | Ran: - git format-patch v9.2.2..v9.2.5 --stdout > patchfile.patch - git checkout -b 9-2-5-security-patch origin/v9.2.2 - git apply patchfile.patch - git commit - [Got the sha ref for the commit] - git checkout -b upstream-9-2-security master - git cherry-pick <SHA of the patchfile commit> - [Resolved conflicts] - git cherry-pick --continue
* Merge branch 'rework-authorizations-performance' into 'master'Douwe Maan2017-05-291-8/+8
|\ | | | | | | | | Rework project authorizations and nested groups for better performance See merge request !10885
| * Use CTEs for nested groups and authorizationsYorick Peterse2017-05-171-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit introduces the usage of Common Table Expressions (CTEs) to efficiently retrieve nested group hierarchies, without having to rely on the "routes" table (which is an _incredibly_ inefficient way of getting the data). This requires a patch to ActiveRecord (found in the added initializer) to work properly as ActiveRecord doesn't support WITH statements properly out of the box. Unfortunately MySQL provides no efficient way of getting nested groups. For example, the old routes setup could easily take 5-10 seconds depending on the amount of "routes" in a database. Providing vastly different logic for both MySQL and PostgreSQL will negatively impact the development process. Because of this the various nested groups related methods return empty relations when used in combination with MySQL. For project authorizations the logic is split up into two classes: * Gitlab::ProjectAuthorizations::WithNestedGroups * Gitlab::ProjectAuthorizations::WithoutNestedGroups Both classes get the fresh project authorizations (= as they should be in the "project_authorizations" table), including nested groups if PostgreSQL is used. The logic of these two classes is quite different apart from their public interface. This complicates development a bit, but unfortunately there is no way around this. This commit also introduces Gitlab::GroupHierarchy. This class can be used to get the ancestors and descendants of a base relation, or both by using a UNION. This in turn is used by methods such as: * Namespace#ancestors * Namespace#descendants * User#all_expanded_groups Again this class relies on CTEs and thus only works on PostgreSQL. The Namespace methods will return an empty relation when MySQL is used, while User#all_expanded_groups will return only the groups a user is a direct member of. Performance wise the impact is quite large. For example, on GitLab.com Namespace#descendants used to take around 580 ms to retrieve data for a particular user. Using CTEs we are able to reduce this down to roughly 1 millisecond, returning the exact same data. == On The Fly Refreshing Refreshing of authorizations on the fly (= when users.authorized_projects_populated was not set) is removed with this commit. This simplifies the code, and ensures any queries used for authorizations are not mutated because they are executed in a Rails scope (e.g. Project.visible_to_user). This commit includes a migration to schedule refreshing authorizations for all users, ensuring all of them have their authorizations in place. Said migration schedules users in batches of 5000, with 5 minutes between every batch to smear the load around a bit. == Spec Changes This commit also introduces some changes to various specs. For example, some specs for ProjectTeam assumed that creating a personal project would _not_ lead to the owner having access, which is incorrect. Because we also no longer refresh authorizations on the fly for new users some code had to be added to the "empty_project" factory. This chunk of code ensures that the owner's permissions are refreshed after creating the project, something that is normally done in Projects::CreateService.
* | Revert "Remove changes that are not absolutely necessary"Douwe Maan2017-05-241-2/+2
| | | | | | This reverts commit b0498c176fa134761d899c9b369be12f1ca789c5
* | Remove changes that are not absolutely necessarydm-fix-routesDouwe Maan2017-05-231-2/+2
| |
* | Fix ambiguous routing issues by teaching router about reserved wordsDouwe Maan2017-05-231-3/+3
|/
* The dynamic path validator can block out partial pathsBob Van Landuyt2017-05-011-0/+7
| | | | So we can block `objects` only when it is contained in `info/lfs` or `gitlab-lfs`
* Check `has_parent?` for determining validation typeBob Van Landuyt2017-05-011-0/+1
|
* Merge branch 'master' into feature/multi-level-container-registry-imagesGrzegorz Bizon2017-04-061-13/+38
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (94 commits) Merge branch 'open-redirect-fix-continue-to' into 'security' Merge branch 'open-redirect-host-fix' into 'security' Merge branch 'path-disclosure-proj-import-export' into 'security' Merge branch '29364-private-projects-mr-fix' Merge branch '30125-markdown-security' Issue title realtime Update CHANGELOG.md for 8.16.9 Update CHANGELOG.md for 8.17.5 Update CHANGELOG.md for 9.0.4 Add "search" optional param and docs for V4 Use PDFLab to render PDFs in GitLab Separate Scala from Java in CI examples Fix broken link Reorganize CI examples, add more links Refactor CI index page Remove deprecated field from workhorse response Use gitlab-workhorse 1.4.3 Document how ETag caching middleware handles query parameters Make group skip validation in the frontend Use NamespaceValidator::WILDCARD_ROUTES in ETag caching middleware ...
| * Fix subgroup repository disappearance if group was moveddz-fix-group-moveDmitriy Zaporozhets2017-04-051-13/+38
| | | | | | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* | Fix namespace specs related to container registryGrzegorz Bizon2017-04-031-1/+3
| |
* | Refactor container registry repository tag stubsGrzegorz Bizon2017-04-031-1/+1
| |
* | Merge branch 'master' into feature/multi-level-container-registry-imagesGrzegorz Bizon2017-04-031-10/+69
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (230 commits) Fix N+1 query in loading pipelines in merge requests Fix Spinach and Capybara dependencies Prevent users from disconnecting gitlab account from CAS 30276 Move issue, mr, todos next to profile dropdown in top nav Refactor SearchController#show Properly eagerly-load the Capybara server for JS feature specs only Updating documentation to include a missing step in the update procedure Eager-load the Capybara server to prevent timeouts Increase Capybara's timeout Add metrics button to Environment Overview page Fix link to Jira service documentation Handle parsing OpenBSD ps output properly to display sidekiq infos on ... Eliminate unnecessary queries that add ~500 ms of load time for a large issue 20914 Limits line length for project home page Allow users to import GitHub projects to subgroups Update dpl CI example Fix the docs:check:links job Don't clean up the gitlab-test-fork_bare repo Make GitLab use Gitaly for commit_is_ancestor Remove unnecessary ORDER BY clause from `forked_to_project_id` subquery ...
| * Merge branch '29843-project-subgroup-transfer' into 'security'Rémy Coutable2017-03-291-10/+69
| | | | | | | | | | | | Use full path for moving directories when changing namespace path See merge request !2078
* | Merge branch 'master' into feature/multi-level-container-registry-imagesGrzegorz Bizon2017-03-271-2/+4
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (192 commits) Implement new service for creating user Update sentry-raven 2.0.2 -> 2.4.0 Update webmock 1.21.0 -> 1.24.6 Update spring 1.7.2 -> 2.0.1 Update simplecov 0.12.0 -> 0.14.1 Update pry-rails 0.3.4 -> 0.3.5 Update pry-byebug 3.4.1 -> 3.4.2 Update flay 2.6.1 -> 2.8.1 Remove Tags filter from Projects Explore dropdown Update capybara-screenshot 1.0.11 -> 1.0.14 Update bullet 5.2.0 -> 5.5.1 Update brakeman 3.4.1 -> 3.6.1 Remove web-console gem Update better_errors 1.0.1 -> 2.1.1 Display flash message to unauthenticated user when creating new issue Fix up emoji tests that should have failed :/ Fix RSpec/DescribeSymbol cop violations Add event limit warning all tabs Cycle Analytics Adding non_archived scope for counting projects Resolve "Gitlab administrator cannot create projects in every group" ... Conflicts: db/schema.rb
| * Fix RSpec/DescribeSymbol cop violationsRobert Speicher2017-03-241-1/+1
| |
| * Add spec that tests ‘LIKE’ query for routes with _Jarka Kadlecova2017-03-221-1/+3
| |
* | Rename container image to repository in specsGrzegorz Bizon2017-03-231-2/+2
| |
* | Merge branch 'master' into feature/multi-level-container-registry-imagesGrzegorz Bizon2017-03-211-2/+16
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (1327 commits) Merge branch 'render-json-leak' into 'security' Merge branch 'ssrf' into 'security' Merge branch 'ssrf' into 'security' Merge branch 'fix-links-target-blank' into 'security' Merge branch '28058-hide-emails-in-atom-feeds' into 'security' Fix karma test Reset filters after click Handle Route#name being nil after an update Only add frontend code coverage instrumentation when generating coverage report fix recompile assets step in 9.0 upgrade guide to use yarn Undo explicit conversion to Integer Make level_value accept string integers Make feature spec more robust Removed d3.js from the main application.js bundle Extend compound status for manual actions specs Update css to be nice and tidy. Fix pipeline status for transition between stages add an index to the ghost column Return 404 in project issues API endpoint when project cannot be found Improve rename projects migration ... Conflicts: doc/ci/docker/using_docker_build.md spec/lib/gitlab/import_export/all_models.yml
| * Merge branch '28447-hybrid-repository-storages' into 'master' Sean McGivern2017-03-071-1/+1
| |\ | | | | | | | | | | | | Update storage settings to allow extra values per shard See merge request !9597
| | * Update storage settings to allow extra values per shard28447-hybrid-repository-storagesAlejandro Rodríguez2017-03-031-1/+1
| | | | | | | | | | | | | | | | | | | | | This will be necessary when adding gitaly settings. This version doesn't make any functional changes, but allows us to include this breaking change in 9.0 and add the needed extra settings in the future with backwards compatibility
| * | Restrict nested group names to prevent ambiguous routesdz-nested-groups-restrictionsDmitriy Zaporozhets2017-03-071-0/+14
| |/ | | | | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
| * Use Namespace#full_path instead of #path where appropriatedm-more-namespace-full-pathDouwe Maan2017-02-231-2/+2
| |
* | Fixes broken and missing testsAndre Guedes2017-02-221-3/+5
|/
* Merge branch 'dz-refactor-full-path' into 'master' Dmitriy Zaporozhets2017-02-081-16/+0
|\ | | | | | | | | 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-16/+0
| | | | | | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* | Merge branch 'dz-limit-nested-groups' into 'master' Douwe Maan2017-02-081-11/+22
|\ \ | |/ |/| | | | | Limit level of nesting for groups See merge request !9000
| * Limit level of nesting for groupsdz-limit-nested-groupsDmitriy Zaporozhets2017-02-081-11/+22
| | | | | | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* | Refresh authorizations when transferring projectsrefresh-permissions-when-moving-projectsYorick Peterse2017-02-071-0/+7
|/ | | | | | | | 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.