Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

migrate existing templates#4353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
sreya merged 2 commits intogroupsfromfix-groups-migration
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletionscoderd/database/migrations/000055_template_acl.up.sql
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,4 +19,30 @@ CREATE TABLE group_members (
UNIQUE(user_id, group_id)
);

-- Insert a group for every organization (which should just be 1).
INSERT INTO groups (
id,
name,
organization_id
) SELECT
id, 'Everyone' as name, id
FROM
organizations;

-- Insert allUsers groups into every existing template to avoid breaking
-- existing deployments.
UPDATE
templates
SET
group_acl = (
SELECT
json_build_object(
organizations.id, array_to_json('{"read"}'::text[])
)
FROM
organizations
WHERE
templates.organization_id = organizations.id
);

COMMIT;
2 changes: 1 addition & 1 deletioncoderd/database/modelmethods.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,7 +7,7 @@ import (
"github.com/coder/coder/coderd/rbac"
)

constAllUsersGroup="allUsers"
constAllUsersGroup="Everyone"

// TemplateACL is a map of user_ids to permissions.
typeTemplateACLmap[string][]rbac.Action
Expand Down
2 changes: 1 addition & 1 deletioncoderd/database/queries.sql.go
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

2 changes: 1 addition & 1 deletioncoderd/database/queries/groups.sql
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -89,7 +89,7 @@ INSERT INTO groups (
organization_id
)
VALUES
(sqlc.arg(organization_id),'allUsers',sqlc.arg(organization_id)) RETURNING*;
(sqlc.arg(organization_id),'Everyone',sqlc.arg(organization_id)) RETURNING*;

-- name: UpdateGroupByID :one
UPDATE
Expand Down
2 changes: 1 addition & 1 deletioncoderd/rbac/authz_internal_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -195,7 +195,7 @@ func TestAuthorizeDomain(t *testing.T) {
t.Parallel()
defOrg:=uuid.New()
unuseID:=uuid.New()
allUsersGroup:="allUsers"
allUsersGroup:="Everyone"

user:=subject{
UserID:"me",
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp