summaryrefslogtreecommitdiff
path: root/spec/policies
Commit message (Collapse)AuthorAgeFilesLines
* Update tests and applicationfix-external-ci-servicesKamil Trzcinski2017-06-131-0/+12
|
* Merge branch '25934-project-snippet-vis' into 'security-9-2'DJ Mountney2017-06-081-2/+2
| | | | | | Fix visibility when referencing snippets See merge request !2101
* Merge branch '3191-deploy-keys-update' into 'master'Rémy Coutable2017-06-071-0/+56
|\ | | | | | | | | | | | | Implement ability to update deploy keys Closes #3191 See merge request !10383
| * Implement ability to update deploy keysAlexander Randa2017-06-021-0/+56
| |
* | Allow group reporters to manage group labels33154-permissions-for-project-labels-and-group-labelsSean McGivern2017-06-051-3/+29
|/ | | | | | | | | Previously, only group masters could do this. However, project reporters can manage project labels, so there doesn't seem to be any need to restrict group labels further. Also, save a query or two by getting a single GroupMember object to find out if the user is a master or not.
* Use CTEs for nested groups and authorizationsYorick Peterse2017-05-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Merge branch 'snippets-finder-visibility' into 'security'Douwe Maan2017-05-101-15/+65
| | | | | | Refactor snippets finder & dont return internal snippets for external users See merge request !2094
* Robustify environment policy specs to pass on EEfix/gb/make-environment-policy-specs-to-pass-on-eeGrzegorz Bizon2017-05-091-1/+1
|
* Add confirm delete protected branch modalSam Rose2017-05-081-1/+1
|
* Merge branch 'feature/gb/manual-actions-protected-branches-permissions' into ↵Kamil Trzciński2017-05-062-0/+110
|\ | | | | | | | | | | | | | | | | | | 'master' Check access to a branch when user triggers manual action Closes #20261 See merge request !10494
| * Use update build policy instead of new play policyGrzegorz Bizon2017-05-051-9/+9
| |
| * Merge commit '3a2b60f7' from 'master'Grzegorz Bizon2017-05-051-0/+141
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '3a2b60f7a0109cdb84e8727a2625318a746e84dc': (151 commits) Fixed Karma spec Reject EE reserved namespace paths in CE as well Updated webpack config Include the bundler:audit job into the static-analysis job Document serializers Add artifact file page that uses the blob viewer Pipeline table mini graph dropdown remains open when table is refreshed Adds off for event hub Compile gitlab-shell go executables Allow to create new branch and empty WIP merge request from issue page Moved to a view spec Improving copy of CONTRIBUTING.md, PROCESS.md, and code_review.md Convert seconds to minutes and hours on chat notifations Disable navigation to Pages config if Pages is disabled Sort the network graph both by commit date and topographically. Add tooltips to note action buttons Add breadcrumb, build header and pipelines submenu to artifacts browser Update todos screenshots removes the possibility of commit messages having carriage returns Handle incoming emails from aliases correctly ...
| * | Fix environment policy class name in specsGrzegorz Bizon2017-05-021-1/+1
| | |
| * | Merge branch 'master' into ↵Grzegorz Bizon2017-05-022-279/+160
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | feature/gb/manual-actions-protected-branches-permissions * master: (314 commits) Better Explore Groups view Update Carrierwave and fog-core Add specs for Gitlab::RequestProfiler Add scripts/static-analysis to run all the static analysers in one go Shorten and improve some job names Group static-analysis jobs into a single job Don't blow up when email has no References header Update CHANGELOG.md for 9.1.2 Add changelog Add changelog Show Raw button as Download for binary files Use blob viewers for snippets Fix typo Fixed transient failure related to dropdown animations Revert "Merge branch 'tc-no-todo-service-select' into 'master'" fix link to MR 10416 Another change from .click -> .trigger('click') to make spec pass Change from .click -> .trigger('click') to make spec pass Disable AddColumnWithDefaultToLargeTable cop for pre-existing migrations Add AddColumnWithDefaultToLargeTable cop ... Conflicts: spec/requests/api/jobs_spec.rb
| * | | Add new ability check for stopping environmentGrzegorz Bizon2017-05-011-0/+57
| | | |
| * | | Merge branch 'master' into ↵Grzegorz Bizon2017-04-131-1/+2
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | feature/gb/manual-actions-protected-branches-permissions * master: (641 commits) Revert "Fix registry for projects with uppercases in path" Fix registry for projects with uppercases in path Move event icons into events_helper Reset New branch button when issue state changes Add link to environments on kubernetes.md Indent system notes on desktop screens Improve webpack-dev-server compatibility with non-localhost setups. Add changelog entry Fix recent searches icon alignment in Safari Use preload to avoid Rails using JOIN Fix NUMBER_OF_TRUNCATED_DIFF_LINES re-definition error Prepare for zero downtime migrations Fix filtered search input width for IE Fix the `gitlab:gitlab_shell:check` task Fixed random failures with Poll spec Include CONTRIBUTING.md file when importing .gitlab-ci.yml templates Let uses hide verbose output by default Separate examples for each other Collapse similar sibling scenarios Use empty_project for resources that are independent of the repo ... Conflicts: app/views/projects/ci/builds/_build.html.haml
| * | | | Implement new rule for manual actions in policiesGrzegorz Bizon2017-04-121-0/+53
| | | | |
* | | | | Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into mia_backort[ci ↵Valery Sizov2017-05-051-0/+141
|\ \ \ \ \ | | |_|_|/ | |/| | | | | | | | skip]
| * | | | Support uploaders for personal snippets comments12910-uploader-pers-snippetJarka Kadlecova2017-05-021-0/+141
| | |_|/ | |/| |
* | | | Fix specsClement Ho2017-05-041-4/+4
|/ / /
* | | Enable RSpec/FilePath copenable-spec-file-name-copSean McGivern2017-04-262-279/+160
| |/ |/| | | | | | | | | - Ignore JS fixtures - Ignore qa directory - Rewrite concern specs to put concern name first
* | Merge branch 'siemens/gitlab-ce-fix/subgroup-hide-button' into 'master' Rémy Coutable2017-04-121-1/+2
|\ \ | |/ |/| | | | | | | | | Hide new subgroup button if user has no permission to create one Closes #30139 See merge request !10627
| * Move permission to create subgroup into GroupPolicyDmitriy Zaporozhets2017-04-111-1/+2
| | | | | | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* | Use `:empty_project` where possible in policy specsRobert Speicher2017-03-272-2/+2
|/
* spec the new behavior of .class_forhttp://jneen.net/2017-03-091-4/+6
| | | | and more robustly spec the ancestor behavior
* Improve pipeline triggers UIKamil Trzciński2017-03-071-0/+103
|
* Don't allow deleting a ghost user.Timothy Andrew2017-02-241-0/+37
| | | | | | | | | | | | | | | - Add a `destroy_user` ability. This didn't exist before, and was implicit in other abilities (only admins could access the admin area, so only they could destroy all users; a user can only access their own account page, and so can destroy only themselves). - Grant this ability to admins, and when the current user is trying to destroy themselves. Disallow destroying ghost users in all cases. - Modify the `Users::DestroyService` to check this ability. Also check it in views to decide whether or not to show the "Delete User" button. - Add a short summary of the Ghost User to the bio.
* More backportDouwe Maan2017-02-062-32/+131
|
* Fix build access policies when pipelines are publicGrzegorz Bizon2017-01-231-0/+93
|
* More improvements to presenters23563-document-presentersRémy Coutable2017-01-181-2/+2
| | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* Handle presenters in BasePolicyRémy Coutable2017-01-181-0/+17
| | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* Include group parents into read access for project and groupDmitriy Zaporozhets2016-12-261-0/+66
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* Add missing group policy specdz-add-group-policy-specDmitriy Zaporozhets2016-12-151-0/+108
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* Update effected testszj-guest-reads-public-buildsZ.J. van de Weg2016-12-041-16/+16
|
* Guests can read builds if those are publicZ.J. van de Weg2016-12-041-7/+29
| | | | Fixes #18448
* Improve ProjectPolicy spec to check permissions when wiki is disabledDouglas Barbosa Alexandre2016-11-301-2/+12
|
* Added tests for IssuePolicyYorick Peterse2016-11-071-0/+119
|
* Allow owners to fetch source code in CI buildsallow-owner-to-run-ci-buildsKamil Trzcinski2016-11-011-0/+14
| | | | Due to different way of handling owners of a project, they were not allowed to fetch CI sources for project.
* Add specs for a user from a group link23872-members-of-group-that-has-project-access-getting-404-on-accessing-a-project-issueSean McGivern2016-10-281-0/+30
|
* Fix project member access for group linksSean McGivern2016-10-281-0/+163
| | | | | | | | | | | | | | | | `ProjectTeam#find_member` doesn't take group links into account. It was used in two places: 1. An admin view - it can stay here. 2. `ProjectTeam#member?`, which is often used to decide if a user has access to view something. This second part broke confidential issues viewing. `IssuesFinder` ends up delegating to `Project#authorized_for_user?`, which does consider group links, so users with access to the project via a group link could see confidential issues on the index page. However, `IssuesPolicy` used `ProjectTeam#member?`, so the same user couldn't view the issue when going to it directly.
* Make guests unable to view MRsguests_cant_see_mrsValery Sizov2016-10-111-2/+3
|
* Improve project policy specAlejandro Rodríguez2016-10-061-16/+131
|
* Test if issue authors can access private projectsFelipe Artur2016-09-201-0/+13
|
* add project_policy_spec to replace .project_abilities spechttp://jneen.net/2016-08-301-0/+36