Skip to content

Commit

Permalink
feat: add admin role for organization (#203)
Browse files Browse the repository at this point in the history
Because

- We want to provide a new `admin` role for organization members, which
allows them to edit the organization and invite other members

This commit

- Adds `admin` role for organizations.
  • Loading branch information
donch1989 authored Apr 23, 2024
1 parent 7521ba6 commit ad161d8
Show file tree
Hide file tree
Showing 7 changed files with 440 additions and 196 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,17 @@ jobs:
with:
repository: instill-ai/instill-core

- name: Load .env file (instill-core)
uses: cardinalby/export-env-action@v2
with:
envFile: .env

- name: Launch Instill Core
run: |
COMPOSE_PROFILES=all \
EDITION=local-ce:test \
RAY_LATEST_TAG=latest \
RAY_RELEASE_TAG=${RAY_SERVER_VERSION} \
docker compose -f docker-compose.yml -f docker-compose-latest.yml up -d --quiet-pull
COMPOSE_PROFILES=all \
EDITION=local-ce:test \
Expand Down
1 change: 1 addition & 0 deletions cmd/init/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ func main() {
if err != nil {
panic(err)
}
// TODO: we should implement a better flow to upgrade the OpenFGA model
if len(*models.AuthorizationModels) == 0 {
var body openfga.ClientWriteAuthorizationModelRequest
if err := json.Unmarshal([]byte(acl.ACLModel), &body); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1
github.com/iancoleman/strcase v0.2.0
github.com/influxdata/influxdb-client-go/v2 v2.12.3
github.com/instill-ai/protogen-go v0.3.3-alpha.0.20240421131913-2918876e5b64
github.com/instill-ai/protogen-go v0.3.3-alpha.0.20240423064822-66cd105bb99c
github.com/instill-ai/usage-client v0.2.4-alpha.0.20240123081026-6c78d9a5197a
github.com/instill-ai/x v0.4.0-alpha
github.com/knadh/koanf v1.5.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1113,8 +1113,8 @@ github.com/influxdata/line-protocol/v2 v2.0.0-20210312151457-c52fdecb625a/go.mod
github.com/influxdata/line-protocol/v2 v2.1.0/go.mod h1:QKw43hdUBg3GTk2iC3iyCxksNj7PX9aUSeYOYE/ceHY=
github.com/influxdata/line-protocol/v2 v2.2.1 h1:EAPkqJ9Km4uAxtMRgUubJyqAr6zgWM0dznKMLRauQRE=
github.com/influxdata/line-protocol/v2 v2.2.1/go.mod h1:DmB3Cnh+3oxmG6LOBIxce4oaL4CPj3OmMPgvauXh+tM=
github.com/instill-ai/protogen-go v0.3.3-alpha.0.20240421131913-2918876e5b64 h1:FWZuA+Sf/MvkCWJMmE1MchMtWZzeEY1AhsL+x30Upm0=
github.com/instill-ai/protogen-go v0.3.3-alpha.0.20240421131913-2918876e5b64/go.mod h1:2blmpUwiTwxIDnrjIqT6FhR5ewshZZF554wzjXFvKpQ=
github.com/instill-ai/protogen-go v0.3.3-alpha.0.20240423064822-66cd105bb99c h1:mkaU0knUzNeyc4n94CYQPSZL81PCgYWeMThAlnoB6ew=
github.com/instill-ai/protogen-go v0.3.3-alpha.0.20240423064822-66cd105bb99c/go.mod h1:2blmpUwiTwxIDnrjIqT6FhR5ewshZZF554wzjXFvKpQ=
github.com/instill-ai/usage-client v0.2.4-alpha.0.20240123081026-6c78d9a5197a h1:gmy8BcCFDZQan40c/D3f62DwTYtlCwi0VrSax+pKffw=
github.com/instill-ai/usage-client v0.2.4-alpha.0.20240123081026-6c78d9a5197a/go.mod h1:EpX3Yr661uWULtZf5UnJHfr5rw2PDyX8ku4Kx0UtYFw=
github.com/instill-ai/x v0.4.0-alpha h1:zQV2VLbSHjMv6gyBN/2mwwrvWk0/mJM6ZKS12AzjfQg=
Expand Down
2 changes: 1 addition & 1 deletion pkg/acl/acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (c *ACLClient) DeleteOrganizationUserMembership(ctx context.Context, orgUID
AuthorizationModelId: c.authorizationModelID,
}

for _, role := range []string{"owner", "member", "pending_owner", "pending_member"} {
for _, role := range []string{"owner", "admin", "member", "pending_owner", "pending_admin", "pending_member"} {
body := openfgaClient.ClientWriteRequest{
Deletes: &[]openfgaClient.ClientTupleKey{
{
Expand Down
Loading

0 comments on commit ad161d8

Please sign in to comment.