Files
ca/Documentation/api/server_service_orgs.md
dissoupovandGitHub a3d0c6811c Events implementation (#5)
* Admin: list projects

* Events implementation
2026-10-17 12:46:22 -05:00

13 KiB

orgs

import "github.com/effective-security/trustyca/server/service/orgs"

Index

Constants

ServiceName provides the Service Name for this package

const ServiceName = "orgs"

func Factory

func Factory(server gserver.GServer) any

Factory returns a factory of the service

type Service

Service defines the Orgs service

type Service struct {
    // contains filtered or unexported fields
}

func (*Service) AddMember

func (s *Service) AddMember(ctx context.Context, req *pb.AddMemberRequest) (*pb.AddMemberResponse, error)

AddMember grants a role org-wide (empty ProjectID) or in a project. If the user does not exist yet, an invite is created at the same scope.

func (*Service) ChangeMemberRole

func (s *Service) ChangeMemberRole(ctx context.Context, req *pb.ChangeMemberRoleRequest) (*pb.Membership, error)

ChangeMemberRole changes the role of an existing grant at the requested scope. The caller must be allowed to grant both the current and the new role at that scope.

func (*Service) Close

func (s *Service) Close()

Close the subservices and its resources

func (*Service) CreateAPIKey

func (s *Service) CreateAPIKey(ctx context.Context, req *pb.CreateAPIKeyRequest) (*pb.APIKey, error)

CreateAPIKey creates a new API key in the org selected in the token, optionally restricted to a project. The public key is encoded as sk_<OrgID>_<protectedKeyID>, where the key ID is protected with the dataprotection key (TODO: per org key); the secret is stored protected and returned to the caller only once.

func (*Service) DeleteAPIKey

func (s *Service) DeleteAPIKey(ctx context.Context, req *pb.APIKeyRequest) (*pb.RecordsResult, error)

DeleteAPIKey deletes an API key of the org selected in the token. When ProjectID is set it must match the project of the key.

func (*Service) DeleteInvite

func (s *Service) DeleteInvite(ctx context.Context, req *pb.DeleteInviteRequest) (*emptypb.Empty, error)

DeleteInvite deletes the invite at the requested scope

func (*Service) DeleteMember

func (s *Service) DeleteMember(ctx context.Context, req *pb.DeleteMemberRequest) (*emptypb.Empty, error)

DeleteMember removes the grant at the requested scope: the project grant with ProjectID, otherwise the org-wide grant. The caller must be allowed to grant the member's role at that scope.

func (*Service) DeleteOrg

func (s *Service) DeleteOrg(ctx context.Context, _ *emptypb.Empty) (*pb.Org, error)

DeleteOrg deactivates the org selected in the token

func (*Service) DeleteProject

func (s *Service) DeleteProject(ctx context.Context, req *pb.DeleteProjectRequest) (*pb.Project, error)

DeleteProject deactivates a project. Memberships, invites and records owned by the project are kept.

func (*Service) GetMembers

func (s *Service) GetMembers(ctx context.Context, req *pb.GetMembersRequest) (*pb.MembersResponse, error)

GetMembers returns grants and invites of the org selected in the token. With ProjectID only the project's grants are returned; with Scope Org only the org-wide grants are returned.

func (*Service) GetOrg

func (s *Service) GetOrg(ctx context.Context, _ *emptypb.Empty) (*pb.Org, error)

GetOrg returns the org selected in the token

func (*Service) GetProject

func (s *Service) GetProject(ctx context.Context, req *pb.GetProjectRequest) (*pb.Project, error)

GetProject returns a project by ID or alias

func (*Service) GetUserMemberships

func (s *Service) GetUserMemberships(ctx context.Context, _ *emptypb.Empty) (*pb.UserMemberships, error)

GetUserMemberships returns the caller's resolved access to the org selected in the token and the caller's explicit grants in that org

func (*Service) GetUserOrgs

func (s *Service) GetUserOrgs(ctx context.Context, _ *emptypb.Empty) (*pb.UserOrgsResponse, error)

GetUserOrgs returns the orgs the caller can select, each once, with the resolved org role. A user with project grants only sees the org as a derived Viewer.

func (*Service) IsReady

func (s *Service) IsReady() bool

IsReady indicates that the service is ready to serve its end-points

func (*Service) ListAPIKeys

func (s *Service) ListAPIKeys(ctx context.Context, req *pb.ListAPIKeysRequest) (*pb.APIKeysResponse, error)

ListAPIKeys lists the API keys of the org selected in the token, or of a project when ProjectID is set

func (*Service) ListProjects

func (s *Service) ListProjects(ctx context.Context, req *pb.ListProjectsRequest) (*pb.ProjectsResponse, error)

ListProjects returns the projects of the org selected in the token that the caller can access: all projects with an org-wide role, otherwise only the projects with an explicit grant

func (*Service) Name

func (s *Service) Name() string

Name returns the service name

func (*Service) OrgsHTTPHandler

func (s *Service) OrgsHTTPHandler() restserver.Handle

func (*Service) RegisterGRPC

func (s *Service) RegisterGRPC(r *grpc.Server)

RegisterGRPC registers gRPC handler

func (*Service) RegisterOrg

func (s *Service) RegisterOrg(ctx context.Context, req *pb.RegisterOrgRequest) (*pb.Org, error)

RegisterOrg registers a new org; the caller becomes its Owner

func (*Service) RegisterProject

func (s *Service) RegisterProject(ctx context.Context, req *pb.RegisterProjectRequest) (*pb.Project, error)

RegisterProject creates a project in the org selected in the token

func (*Service) RegisterRoute

func (s *Service) RegisterRoute(r restserver.Router)

RegisterRoute adds the Status API endpoints to the overall URL router

func (*Service) UpdateOrg

func (s *Service) UpdateOrg(ctx context.Context, req *pb.UpdateOrgRequest) (*pb.Org, error)

UpdateOrg updates the org selected in the token

func (*Service) UpdateProject

func (s *Service) UpdateProject(ctx context.Context, req *pb.UpdateProjectRequest) (*pb.Project, error)

UpdateProject updates a project

Generated by gomarkdoc