This repository was archived by the owner on Sep 30, 2024. It is now read-only.
feature/db/sub_repo_perms: add IPs column to sub repo perms#63771
Merged
ggilmore merged 3 commits intoJul 18, 2024
Merged
Conversation
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
4957d56 to
ef0c925
Compare
ef0c925 to
930b4a7
Compare
ggilmore
commented
Jul 16, 2024
| "sub_repo_permissions_repo_id_user_id_version_uindex" UNIQUE, btree (repo_id, user_id, version) | ||
| "sub_repo_perms_user_id" btree (user_id) | ||
| Check constraints: | ||
| "ips_paths_length_check" CHECK (ips IS NULL OR array_length(ips, 1) = array_length(paths, 1) AND NOT (''::text = ANY (ips))) |
Contributor
Author
There was a problem hiding this comment.
This ensures
- that we have an IP address associated with each path entry, or no ips at all (if the perforce permissions syncer hasn't been updated yet to save those)
- that we have no blank IP address entries (this doesn't seem to be possible in perforce, so there is no reason to allow it here either)
eseliger
reviewed
Jul 16, 2024
eseliger
left a comment
Member
There was a problem hiding this comment.
Needs a test plan, the auditor wrongly marked this as ok.
eseliger
approved these changes
Jul 17, 2024
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This PR modifies the sub_repo_permissions database to store the ip addresses associated with each Perforce path rule, as part of the IP based sub repo permissions work.
The new IP column is implemetned as a []text similar to the path column. The IP address associated with
paths[0]is stored in the ips column inips[0].For example, the follownig proections table
turns into the following rows in the sub_repo_permissions table
"//depot/elm_proj/..."}"*"}"//..."}"*"}"-//..."}"192.168.41.0/24"}"-//..."}"2001:db8:1:2::]/64"}"-//..."}"*"}"-//depot/...","//depot/doc/..."}"*","*"}"//..."}"*"}Test plan
The unit test for the sub_repository_permissions store PR that is built on this PR: https://app.graphite.dev/github/pr/sourcegraph/sourcegraph/63811/internal-database-sub_repo_permissions-modify-store-to-be-able-to-insert-ip-based-permissions
Changelog