From c99c1c5a7e9f3d49b5b97089e3f86b063bae761e Mon Sep 17 00:00:00 2001 From: niravparikh05 Date: Thu, 14 Apr 2022 18:36:55 +0530 Subject: [PATCH] reverting changes for isGlobal in role resource --- gen/openapi/proto/rpc/role/role.swagger.json | 26 ++++ internal/models/role.go | 1 + .../000007_authsrv_resourcerole.up.sql | 1 + pkg/service/role.go | 6 +- pkg/service/role_test.go | 20 +-- proto/types/rolepb/v3/role.pb.go | 121 ++++++++++-------- proto/types/rolepb/v3/role.proto | 9 +- 7 files changed, 117 insertions(+), 67 deletions(-) diff --git a/gen/openapi/proto/rpc/role/role.swagger.json b/gen/openapi/proto/rpc/role/role.swagger.json index 14faf20..da289a3 100644 --- a/gen/openapi/proto/rpc/role/role.swagger.json +++ b/gen/openapi/proto/rpc/role/role.swagger.json @@ -141,6 +141,13 @@ }, "collectionFormat": "multi" }, + { + "name": "spec.isGlobal", + "description": "IsGlobal. Specify if this is a global role", + "in": "query", + "required": false, + "type": "boolean" + }, { "name": "spec.scope", "description": "Scope. Scope of role", @@ -316,6 +323,13 @@ }, "collectionFormat": "multi" }, + { + "name": "spec.isGlobal", + "description": "IsGlobal. Specify if this is a global role", + "in": "query", + "required": false, + "type": "boolean" + }, { "name": "spec.scope", "description": "Scope. Scope of role", @@ -551,6 +565,13 @@ }, "collectionFormat": "multi" }, + { + "name": "spec.isGlobal", + "description": "IsGlobal. Specify if this is a global role", + "in": "query", + "required": false, + "type": "boolean" + }, { "name": "spec.scope", "description": "Scope. Scope of role", @@ -924,6 +945,11 @@ "description": "Permissions for the role", "title": "Role Permissions" }, + "isGlobal": { + "type": "boolean", + "description": "Specify if this is a global role", + "title": "IsGlobal" + }, "scope": { "type": "string", "description": "Scope of role", diff --git a/internal/models/role.go b/internal/models/role.go index 99e4440..0548173 100644 --- a/internal/models/role.go +++ b/internal/models/role.go @@ -18,6 +18,7 @@ type Role struct { Trash bool `bun:"trash,notnull,default:false"` OrganizationId uuid.UUID `bun:"organization_id,type:uuid"` PartnerId uuid.UUID `bun:"partner_id,type:uuid"` + IsGlobal bool `bun:"is_global,notnull,default:true"` Builtin bool `bun:"builtin,notnull,default:true"` Scope string `bun:"scope,notnull"` } diff --git a/persistence/migrations/admindb/000007_authsrv_resourcerole.up.sql b/persistence/migrations/admindb/000007_authsrv_resourcerole.up.sql index e87d108..3a3df9a 100644 --- a/persistence/migrations/admindb/000007_authsrv_resourcerole.up.sql +++ b/persistence/migrations/admindb/000007_authsrv_resourcerole.up.sql @@ -5,6 +5,7 @@ CREATE TABLE IF NOT EXISTS authsrv_resourcerole ( created_at timestamp with time zone NOT NULL, modified_at timestamp with time zone NOT NULL, trash boolean NOT NULL, + is_global boolean NOT NULL, builtin boolean NOT NULL, scope character varying(256) NOT NULL, organization_id uuid, diff --git a/pkg/service/role.go b/pkg/service/role.go index 8004bd7..ec2eed4 100644 --- a/pkg/service/role.go +++ b/pkg/service/role.go @@ -153,6 +153,7 @@ func (s *roleService) Create(ctx context.Context, role *rolev3.Role) (*rolev3.Ro Trash: false, OrganizationId: organizationId, PartnerId: partnerId, + IsGlobal: role.GetSpec().GetIsGlobal(), Builtin: builtin, Scope: strings.ToLower(scope), } @@ -257,6 +258,7 @@ func (s *roleService) Update(ctx context.Context, role *rolev3.Role) (*rolev3.Ro rle.Name = role.Metadata.Name rle.Description = role.Metadata.Description rle.Scope = role.Spec.Scope + rle.IsGlobal = role.Spec.IsGlobal rle.ModifiedAt = time.Now() tx, err := s.db.BeginTx(ctx, &sql.TxOptions{}) @@ -284,7 +286,8 @@ func (s *roleService) Update(ctx context.Context, role *rolev3.Role) (*rolev3.Ro //update spec and status role.Spec = &rolev3.RoleSpec{ - Scope: rle.Scope, + IsGlobal: rle.IsGlobal, + Scope: rle.Scope, } err = tx.Commit() @@ -371,6 +374,7 @@ func (s *roleService) toV3Role(ctx context.Context, db bun.IDB, role *rolev3.Rol } role.Spec = &rolev3.RoleSpec{ + IsGlobal: rle.IsGlobal, Scope: rle.Scope, Rolepermissions: permissions, Builtin: rle.Builtin, diff --git a/pkg/service/role_test.go b/pkg/service/role_test.go index 02a1a7b..f6a9e08 100644 --- a/pkg/service/role_test.go +++ b/pkg/service/role_test.go @@ -69,7 +69,7 @@ func TestCreateRole(t *testing.T) { role := &rolev3.Role{ Metadata: &v3.Metadata{Partner: "partner-" + puuid, Organization: "org-" + ouuid, Name: "role-" + ruuid}, - Spec: &rolev3.RoleSpec{Scope: "system"}, + Spec: &rolev3.RoleSpec{IsGlobal: true, Scope: "system"}, } role, err := rs.Create(context.Background(), role) if err != nil { @@ -92,13 +92,13 @@ func TestCreateRoleNoBuiltinOverride(t *testing.T) { mock.ExpectBegin() // TODO: more precise checks - mock.ExpectQuery(`INSERT INTO "authsrv_resourcerole".* FALSE, 'system'`). + mock.ExpectQuery(`INSERT INTO "authsrv_resourcerole".* TRUE, FALSE, 'system'`). WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(ruuid)) mock.ExpectCommit() role := &rolev3.Role{ Metadata: &v3.Metadata{Partner: "partner-" + puuid, Organization: "org-" + ouuid, Name: "role-" + ruuid}, - Spec: &rolev3.RoleSpec{Scope: "system", Builtin: true}, + Spec: &rolev3.RoleSpec{IsGlobal: true, Scope: "system", Builtin: true}, } role, err := rs.Create(context.Background(), role) if err != nil { @@ -122,13 +122,13 @@ func TestCreateRoleBuiltinOverride(t *testing.T) { mock.ExpectBegin() // TODO: more precise checks - mock.ExpectQuery(`INSERT INTO "authsrv_resourcerole".* TRUE, 'system'`). + mock.ExpectQuery(`INSERT INTO "authsrv_resourcerole".* TRUE, TRUE, 'system'`). WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(ruuid)) mock.ExpectCommit() role := &rolev3.Role{ Metadata: &v3.Metadata{Partner: "partner-" + puuid, Organization: "org-" + ouuid, Name: "role-" + ruuid}, - Spec: &rolev3.RoleSpec{Scope: "system", Builtin: true}, + Spec: &rolev3.RoleSpec{IsGlobal: true, Scope: "system", Builtin: true}, } internalCtx := context.WithValue(context.Background(), common.SessionInternalKey, true) @@ -163,7 +163,7 @@ func TestCreateRoleWithPermissions(t *testing.T) { role := &rolev3.Role{ Metadata: &v3.Metadata{Partner: "partner-" + puuid, Organization: "org-" + ouuid, Name: "role-" + ruuid}, - Spec: &rolev3.RoleSpec{Scope: "system", Rolepermissions: []string{"ops_star.all"}}, + Spec: &rolev3.RoleSpec{IsGlobal: true, Scope: "system", Rolepermissions: []string{"ops_star.all"}}, } role, err := rs.Create(context.Background(), role) if err != nil { @@ -194,7 +194,7 @@ func TestCreateRoleDuplicate(t *testing.T) { role := &rolev3.Role{ Metadata: &v3.Metadata{Partner: "partner-" + puuid, Organization: "org-" + ouuid, Name: "role-" + ruuid}, - Spec: &rolev3.RoleSpec{Scope: "system"}, + Spec: &rolev3.RoleSpec{IsGlobal: true, Scope: "system"}, } _, err := rs.Create(context.Background(), role) if err == nil { @@ -216,7 +216,7 @@ func TestUpdateRole(t *testing.T) { WithArgs().WillReturnRows(sqlmock.NewRows([]string{"id", "name", "organization_id", "partner_id"}).AddRow(ruuid, "role-"+ruuid, ouuid, puuid)) mock.ExpectBegin() - mock.ExpectExec(`UPDATE "authsrv_resourcerole" AS "resourcerole" SET "name" = 'role-` + ruuid + `', .*"organization_id" = '` + ouuid + `', "partner_id" = '` + puuid + `', "builtin" = FALSE, "scope" = 'system' WHERE .id = '` + ruuid + `'.`). + mock.ExpectExec(`UPDATE "authsrv_resourcerole" AS "resourcerole" SET "name" = 'role-` + ruuid + `', .*"organization_id" = '` + ouuid + `', "partner_id" = '` + puuid + `', "is_global" = TRUE, "builtin" = FALSE, "scope" = 'system' WHERE .id = '` + ruuid + `'.`). WillReturnResult(sqlmock.NewResult(1, 1)) mock.ExpectExec(`UPDATE "authsrv_resourcerolepermission" AS "resourcerolepermission" SET trash = TRUE WHERE ."resource_role_id" = '` + ruuid + `'.`). WillReturnResult(sqlmock.NewResult(1, 1)) @@ -229,7 +229,7 @@ func TestUpdateRole(t *testing.T) { role := &rolev3.Role{ Metadata: &v3.Metadata{Partner: "partner-" + puuid, Organization: "org-" + ouuid, Name: "role-" + ruuid}, - Spec: &rolev3.RoleSpec{Scope: "system", Rolepermissions: []string{"ops_star.all"}}, + Spec: &rolev3.RoleSpec{IsGlobal: true, Scope: "system", Rolepermissions: []string{"ops_star.all"}}, } role, err := rs.Update(context.Background(), role) if err != nil { @@ -252,7 +252,7 @@ func TestUpdateRoleBuiltin(t *testing.T) { role := &rolev3.Role{ Metadata: &v3.Metadata{Partner: "partner-" + puuid, Organization: "org-" + ouuid, Name: "role-" + ruuid}, - Spec: &rolev3.RoleSpec{Scope: "system", Rolepermissions: []string{"ops_star.all"}}, + Spec: &rolev3.RoleSpec{IsGlobal: true, Scope: "system", Rolepermissions: []string{"ops_star.all"}}, } _, err := rs.Update(context.Background(), role) if err == nil { diff --git a/proto/types/rolepb/v3/role.pb.go b/proto/types/rolepb/v3/role.pb.go index 6093153..37cc36b 100644 --- a/proto/types/rolepb/v3/role.pb.go +++ b/proto/types/rolepb/v3/role.pb.go @@ -107,8 +107,9 @@ type RoleSpec struct { unknownFields protoimpl.UnknownFields Rolepermissions []string `protobuf:"bytes,1,rep,name=rolepermissions,proto3" json:"rolepermissions,omitempty"` - Scope string `protobuf:"bytes,2,opt,name=scope,proto3" json:"scope,omitempty"` - Builtin bool `protobuf:"varint,3,opt,name=builtin,proto3" json:"builtin,omitempty"` + IsGlobal bool `protobuf:"varint,2,opt,name=isGlobal,proto3" json:"isGlobal,omitempty"` + Scope string `protobuf:"bytes,3,opt,name=scope,proto3" json:"scope,omitempty"` + Builtin bool `protobuf:"varint,4,opt,name=builtin,proto3" json:"builtin,omitempty"` } func (x *RoleSpec) Reset() { @@ -150,6 +151,13 @@ func (x *RoleSpec) GetRolepermissions() []string { return nil } +func (x *RoleSpec) GetIsGlobal() bool { + if x != nil { + return x.IsGlobal + } + return false +} + func (x *RoleSpec) GetScope() string { if x != nil { return x.Scope @@ -283,65 +291,70 @@ var file_proto_types_rolepb_v3_role_proto_rawDesc = []byte{ 0x92, 0x41, 0x34, 0x0a, 0x32, 0x2a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x32, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0xd2, 0x01, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0xd2, 0x01, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0xd2, 0x01, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0xd2, 0x01, 0x04, 0x73, 0x70, 0x65, 0x63, 0x22, 0x92, 0x02, 0x0a, 0x08, 0x52, 0x6f, 0x6c, 0x65, + 0xd2, 0x01, 0x04, 0x73, 0x70, 0x65, 0x63, 0x22, 0xdf, 0x02, 0x0a, 0x08, 0x52, 0x6f, 0x6c, 0x65, 0x53, 0x70, 0x65, 0x63, 0x12, 0x59, 0x0a, 0x0f, 0x72, 0x6f, 0x6c, 0x65, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x42, 0x2f, 0x92, 0x41, 0x2c, 0x2a, 0x10, 0x52, 0x6f, 0x6c, 0x65, 0x20, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x32, 0x18, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x6f, 0x6c, 0x65, 0x52, 0x0f, 0x72, 0x6f, 0x6c, 0x65, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, - 0x2f, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x19, - 0x92, 0x41, 0x16, 0x2a, 0x05, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x32, 0x0d, 0x53, 0x63, 0x6f, 0x70, - 0x65, 0x20, 0x6f, 0x66, 0x20, 0x72, 0x6f, 0x6c, 0x65, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, - 0x12, 0x4b, 0x0a, 0x07, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x08, 0x42, 0x31, 0x92, 0x41, 0x2e, 0x2a, 0x07, 0x42, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x32, - 0x21, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x79, 0x20, 0x69, 0x66, 0x20, 0x74, 0x68, 0x69, 0x73, - 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x20, 0x72, 0x6f, - 0x6c, 0x65, 0x40, 0x01, 0x52, 0x07, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x3a, 0x2d, 0x92, - 0x41, 0x2a, 0x0a, 0x28, 0x2a, 0x12, 0x52, 0x6f, 0x6c, 0x65, 0x20, 0x53, 0x70, 0x65, 0x63, 0x69, - 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0x12, 0x52, 0x6f, 0x6c, 0x65, 0x20, 0x73, - 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x99, 0x03, 0x0a, - 0x08, 0x52, 0x6f, 0x6c, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x59, 0x0a, 0x0a, 0x61, 0x70, 0x69, - 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x39, 0x92, - 0x41, 0x36, 0x2a, 0x0b, 0x41, 0x50, 0x49, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x32, - 0x25, 0x41, 0x50, 0x49, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, - 0x74, 0x68, 0x65, 0x20, 0x72, 0x6f, 0x6c, 0x65, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x72, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x40, 0x01, 0x52, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x42, 0x2b, 0x92, 0x41, 0x28, 0x2a, 0x04, 0x4b, 0x69, 0x6e, 0x64, 0x32, 0x1e, 0x4b, - 0x69, 0x6e, 0x64, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x6f, 0x6c, 0x65, 0x20, - 0x6c, 0x69, 0x73, 0x74, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x40, 0x01, 0x52, - 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x12, 0x78, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x72, 0x61, 0x66, 0x61, 0x79, 0x2e, - 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, - 0x2e, 0x76, 0x33, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x42, 0x33, 0x92, 0x41, 0x30, 0x2a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x32, - 0x22, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, + 0x4b, 0x0a, 0x08, 0x69, 0x73, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x08, 0x42, 0x2f, 0x92, 0x41, 0x2c, 0x2a, 0x08, 0x49, 0x73, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, + 0x32, 0x20, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x79, 0x20, 0x69, 0x66, 0x20, 0x74, 0x68, 0x69, + 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x20, 0x72, 0x6f, + 0x6c, 0x65, 0x52, 0x08, 0x69, 0x73, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x12, 0x2f, 0x0a, 0x05, + 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x19, 0x92, 0x41, 0x16, + 0x2a, 0x05, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x32, 0x0d, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x20, 0x6f, + 0x66, 0x20, 0x72, 0x6f, 0x6c, 0x65, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x4b, 0x0a, + 0x07, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x42, 0x31, + 0x92, 0x41, 0x2e, 0x2a, 0x07, 0x42, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x32, 0x21, 0x53, 0x70, + 0x65, 0x63, 0x69, 0x66, 0x79, 0x20, 0x69, 0x66, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, + 0x20, 0x61, 0x20, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x20, 0x72, 0x6f, 0x6c, 0x65, 0x40, + 0x01, 0x52, 0x07, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x3a, 0x2d, 0x92, 0x41, 0x2a, 0x0a, + 0x28, 0x2a, 0x12, 0x52, 0x6f, 0x6c, 0x65, 0x20, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0x12, 0x52, 0x6f, 0x6c, 0x65, 0x20, 0x73, 0x70, 0x65, 0x63, + 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x99, 0x03, 0x0a, 0x08, 0x52, 0x6f, + 0x6c, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x59, 0x0a, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x39, 0x92, 0x41, 0x36, 0x2a, + 0x0b, 0x41, 0x50, 0x49, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x32, 0x25, 0x41, 0x50, + 0x49, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x6f, 0x6c, 0x65, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x40, 0x01, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, - 0x59, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, - 0x2e, 0x72, 0x61, 0x66, 0x61, 0x79, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x72, 0x6f, 0x6c, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x6f, 0x6c, 0x65, 0x42, 0x24, 0x92, - 0x41, 0x21, 0x2a, 0x05, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x32, 0x16, 0x4c, 0x69, 0x73, 0x74, 0x20, - 0x6f, 0x66, 0x20, 0x72, 0x6f, 0x6c, 0x65, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x73, 0x40, 0x01, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x3a, 0x1c, 0x92, 0x41, 0x19, 0x0a, - 0x17, 0x2a, 0x08, 0x52, 0x6f, 0x6c, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x32, 0x09, 0x52, 0x6f, 0x6c, - 0x65, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x40, 0x01, 0x42, 0xe8, 0x01, 0x0a, 0x1b, 0x63, 0x6f, 0x6d, - 0x2e, 0x72, 0x61, 0x66, 0x61, 0x79, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x72, 0x6f, 0x6c, 0x65, 0x2e, 0x76, 0x33, 0x42, 0x09, 0x52, 0x6f, 0x6c, 0x65, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x52, 0x61, 0x66, 0x61, 0x79, 0x4c, 0x61, 0x62, 0x73, 0x2f, 0x72, 0x63, 0x6c, 0x6f, - 0x75, 0x64, 0x2d, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2f, 0x72, 0x6f, 0x6c, 0x65, 0x70, 0x62, 0x2f, 0x76, 0x33, 0x3b, 0x72, 0x6f, - 0x6c, 0x65, 0x76, 0x33, 0xa2, 0x02, 0x04, 0x52, 0x44, 0x54, 0x52, 0xaa, 0x02, 0x17, 0x52, 0x61, - 0x66, 0x61, 0x79, 0x2e, 0x44, 0x65, 0x76, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x6f, - 0x6c, 0x65, 0x2e, 0x56, 0x33, 0xca, 0x02, 0x17, 0x52, 0x61, 0x66, 0x61, 0x79, 0x5c, 0x44, 0x65, - 0x76, 0x5c, 0x54, 0x79, 0x70, 0x65, 0x73, 0x5c, 0x52, 0x6f, 0x6c, 0x65, 0x5c, 0x56, 0x33, 0xe2, - 0x02, 0x23, 0x52, 0x61, 0x66, 0x61, 0x79, 0x5c, 0x44, 0x65, 0x76, 0x5c, 0x54, 0x79, 0x70, 0x65, - 0x73, 0x5c, 0x52, 0x6f, 0x6c, 0x65, 0x5c, 0x56, 0x33, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1b, 0x52, 0x61, 0x66, 0x61, 0x79, 0x3a, 0x3a, 0x44, - 0x65, 0x76, 0x3a, 0x3a, 0x54, 0x79, 0x70, 0x65, 0x73, 0x3a, 0x3a, 0x52, 0x6f, 0x6c, 0x65, 0x3a, - 0x3a, 0x56, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x63, 0x65, 0x40, 0x01, 0x52, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x3f, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x2b, 0x92, 0x41, 0x28, 0x2a, 0x04, 0x4b, 0x69, 0x6e, 0x64, 0x32, 0x1e, 0x4b, 0x69, 0x6e, 0x64, + 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x6f, 0x6c, 0x65, 0x20, 0x6c, 0x69, 0x73, + 0x74, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x40, 0x01, 0x52, 0x04, 0x6b, 0x69, + 0x6e, 0x64, 0x12, 0x78, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x72, 0x61, 0x66, 0x61, 0x79, 0x2e, 0x64, 0x65, 0x76, + 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x33, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x33, 0x92, + 0x41, 0x30, 0x2a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x32, 0x22, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x6f, + 0x6c, 0x65, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x40, 0x01, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x59, 0x0a, 0x05, + 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x72, 0x61, + 0x66, 0x61, 0x79, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x72, 0x6f, + 0x6c, 0x65, 0x2e, 0x76, 0x33, 0x2e, 0x52, 0x6f, 0x6c, 0x65, 0x42, 0x24, 0x92, 0x41, 0x21, 0x2a, + 0x05, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x32, 0x16, 0x4c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, + 0x72, 0x6f, 0x6c, 0x65, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x40, 0x01, + 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x3a, 0x1c, 0x92, 0x41, 0x19, 0x0a, 0x17, 0x2a, 0x08, + 0x52, 0x6f, 0x6c, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x32, 0x09, 0x52, 0x6f, 0x6c, 0x65, 0x20, 0x6c, + 0x69, 0x73, 0x74, 0x40, 0x01, 0x42, 0xe8, 0x01, 0x0a, 0x1b, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x61, + 0x66, 0x61, 0x79, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x72, 0x6f, + 0x6c, 0x65, 0x2e, 0x76, 0x33, 0x42, 0x09, 0x52, 0x6f, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x52, + 0x61, 0x66, 0x61, 0x79, 0x4c, 0x61, 0x62, 0x73, 0x2f, 0x72, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2d, + 0x62, 0x61, 0x73, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2f, 0x72, 0x6f, 0x6c, 0x65, 0x70, 0x62, 0x2f, 0x76, 0x33, 0x3b, 0x72, 0x6f, 0x6c, 0x65, 0x76, + 0x33, 0xa2, 0x02, 0x04, 0x52, 0x44, 0x54, 0x52, 0xaa, 0x02, 0x17, 0x52, 0x61, 0x66, 0x61, 0x79, + 0x2e, 0x44, 0x65, 0x76, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x52, 0x6f, 0x6c, 0x65, 0x2e, + 0x56, 0x33, 0xca, 0x02, 0x17, 0x52, 0x61, 0x66, 0x61, 0x79, 0x5c, 0x44, 0x65, 0x76, 0x5c, 0x54, + 0x79, 0x70, 0x65, 0x73, 0x5c, 0x52, 0x6f, 0x6c, 0x65, 0x5c, 0x56, 0x33, 0xe2, 0x02, 0x23, 0x52, + 0x61, 0x66, 0x61, 0x79, 0x5c, 0x44, 0x65, 0x76, 0x5c, 0x54, 0x79, 0x70, 0x65, 0x73, 0x5c, 0x52, + 0x6f, 0x6c, 0x65, 0x5c, 0x56, 0x33, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x1b, 0x52, 0x61, 0x66, 0x61, 0x79, 0x3a, 0x3a, 0x44, 0x65, 0x76, 0x3a, + 0x3a, 0x54, 0x79, 0x70, 0x65, 0x73, 0x3a, 0x3a, 0x52, 0x6f, 0x6c, 0x65, 0x3a, 0x3a, 0x56, 0x33, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/types/rolepb/v3/role.proto b/proto/types/rolepb/v3/role.proto index eb8897f..59ae5d8 100644 --- a/proto/types/rolepb/v3/role.proto +++ b/proto/types/rolepb/v3/role.proto @@ -56,12 +56,17 @@ message RoleSpec { title : "Role Permissions" description : "Permissions for the role" } ]; - string scope = 2 + bool isGlobal = 2 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "IsGlobal" + description : "Specify if this is a global role" + } ]; + string scope = 3 [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { title : "Scope" description : "Scope of role" } ]; - bool builtin = 3 + bool builtin = 4 [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { title : "Builtin" description : "Specify if this is a builtin role"