controllers

package
v0.0.0-...-8540621 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultProjectName string = "default"

DefaultProjectName is the name of the default project we automatically assign to every org.

Variables

This section is empty.

Functions

This section is empty.

Types

type OrgDatastore

type OrgDatastore interface {
	// ApproveAllOrgUsers sets is_approved for all users.
	ApproveAllOrgUsers(uuid.UUID) error
	// UpdateOrg updates the orgs info.
	UpdateOrg(*datastore.OrgInfo) error
	// CreateOrg creates a new org.
	CreateOrg(*datastore.OrgInfo) (uuid.UUID, error)
	// GetOrgs gets all the orgs.
	GetOrgs() ([]*datastore.OrgInfo, error)
	// GetUsersInOrg gets all of the users in the given org.
	GetUsersInOrg(uuid.UUID) ([]*datastore.UserInfo, error)
	// NumUsersInOrg gets the count of users in the given org.
	NumUsersInOrg(uuid.UUID) (int, error)
	// GetOrg gets and org by ID.
	GetOrg(uuid.UUID) (*datastore.OrgInfo, error)
	// GetOrgByName gets an org by name.
	GetOrgByName(string) (*datastore.OrgInfo, error)
	// GetOrgByDomain gets an org by domain name.
	GetOrgByDomain(string) (*datastore.OrgInfo, error)
	// Delete Org and all of its users
	DeleteOrgAndUsers(uuid.UUID) error
	// GetInviteSigningKey gets the invite signing key for the given orgID.
	GetInviteSigningKey(uuid.UUID) (string, error)
	// CreateInviteSigningKey creates an invite signing key for the given orgID.
	CreateInviteSigningKey(uuid.UUID) (string, error)
}

OrgDatastore is the interface used as the backing store for org information.

type OrgSettingsDatastore

type OrgSettingsDatastore interface {
	// AddIDEConfig adds the IDE config to the org.
	AddIDEConfig(uuid.UUID, *datastore.IDEConfig) error
	// DeleteIDEConfig deletes the IDE config from the org.
	DeleteIDEConfig(uuid.UUID, string) error
	// GetIDEConfigs gets all IDE configs for the org.
	GetIDEConfigs(uuid.UUID) ([]*datastore.IDEConfig, error)
	// GetIDEConfig gets the IDE config for the IDE with the given name.
	GetIDEConfig(uuid.UUID, string) (*datastore.IDEConfig, error)
}

OrgSettingsDatastore is the interface used as the backing store for org settings. This includes IDE configs and various other settings that users can configure for orgs.

type Server

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

Server is an implementation of GRPC server for profile service.

func NewServer

NewServer creates a new GRPC profile server.

func (*Server) AddOrgIDEConfig

AddOrgIDEConfig adds the IDE config for the given org.

func (*Server) CreateInviteToken

func (s *Server) CreateInviteToken(ctx context.Context, req *profilepb.CreateInviteTokenRequest) (*profilepb.InviteToken, error)

CreateInviteToken creates a signed invite JWT for the given org with an expiration of 1 week.

func (*Server) CreateOrg

func (s *Server) CreateOrg(ctx context.Context, req *profilepb.CreateOrgRequest) (*uuidpb.UUID, error)

CreateOrg is the GRPC method to create a new org.

func (*Server) CreateOrgAndUser

CreateOrgAndUser is the GRPC method to create a new org and user.

func (*Server) CreateUser

func (s *Server) CreateUser(ctx context.Context, req *profilepb.CreateUserRequest) (*uuidpb.UUID, error)

CreateUser is the GRPC method to create new user.

func (*Server) DeleteOrgAndUsers

func (s *Server) DeleteOrgAndUsers(ctx context.Context, req *uuidpb.UUID) error

DeleteOrgAndUsers deletes an org and all of its users.

func (*Server) DeleteOrgIDEConfig

DeleteOrgIDEConfig deletes the IDE config from the given org.

func (*Server) DeleteUser

DeleteUser deletes a user. If they are the last user in the org, also deletes the org.

func (*Server) GetOrg

func (s *Server) GetOrg(ctx context.Context, req *uuidpb.UUID) (*profilepb.OrgInfo, error)

GetOrg is the GRPC method to get an org by ID.

func (*Server) GetOrgByDomain

func (s *Server) GetOrgByDomain(ctx context.Context, req *profilepb.GetOrgByDomainRequest) (*profilepb.OrgInfo, error)

GetOrgByDomain gets an org by domain name. This is the domain_name field which is auto populated by the hosted domain returned from the auth provider. This might be an empty string for auth users that don't have a hosted domain or NULL for orgs that haven't been backfilled.

func (*Server) GetOrgByName

func (s *Server) GetOrgByName(ctx context.Context, req *profilepb.GetOrgByNameRequest) (*profilepb.OrgInfo, error)

GetOrgByName gets an org by name. This is the org_name field, and currently happens to be either the entire email of a user or just the domain from a user's email depending on whether said user is in a self org or not.

func (*Server) GetOrgIDEConfigs

GetOrgIDEConfigs gets all IDE configs from the given org.

func (*Server) GetOrgs

GetOrgs is the GRPC method to get all orgs. This should only be used internally.

func (*Server) GetUser

func (s *Server) GetUser(ctx context.Context, req *uuidpb.UUID) (*profilepb.UserInfo, error)

GetUser is the GRPC method to get a user.

func (*Server) GetUserAttributes

GetUserAttributes gets the user attributes for the given user.

func (*Server) GetUserByAuthProviderID

func (s *Server) GetUserByAuthProviderID(ctx context.Context, req *profilepb.GetUserByAuthProviderIDRequest) (*profilepb.UserInfo, error)

GetUserByAuthProviderID returns the user identified by the AuthProviderID.

func (*Server) GetUserByEmail

func (s *Server) GetUserByEmail(ctx context.Context, req *profilepb.GetUserByEmailRequest) (*profilepb.UserInfo, error)

GetUserByEmail is the GRPC method to get a user by email.

func (*Server) GetUserSettings

GetUserSettings gets the user settings for the given user.

func (*Server) GetUsersInOrg

GetUsersInOrg gets the users in the requested org, given that the requestor has permissions.

func (*Server) RevokeAllInviteTokens

func (s *Server) RevokeAllInviteTokens(ctx context.Context, req *uuidpb.UUID) (*types.Empty, error)

RevokeAllInviteTokens revokes all pending invited for the given org by rotating the JWT signing key.

func (*Server) SetUserAttributes

SetUserAttributes sets the user attributes for the given user.

func (*Server) UpdateOrg

func (s *Server) UpdateOrg(ctx context.Context, req *profilepb.UpdateOrgRequest) (*profilepb.OrgInfo, error)

UpdateOrg updates an orgs info.

func (*Server) UpdateUser

UpdateUser updates a user's info.

func (*Server) UpdateUserSettings

UpdateUserSettings sets the user settings for the given user.

func (*Server) VerifyInviteToken

VerifyInviteToken verifies that the given invite JWT is still valid by performing expiration and signing key checks.

type UserDatastore

type UserDatastore interface {
	// CreateUser creates a new user.
	CreateUser(*datastore.UserInfo) (uuid.UUID, error)
	// GetUser gets a user by ID.
	GetUser(uuid.UUID) (*datastore.UserInfo, error)
	// GetUserByEmail gets a user by email.
	GetUserByEmail(string) (*datastore.UserInfo, error)
	// GetUserByAuthProviderID returns the user that matches the AuthProviderID.
	GetUserByAuthProviderID(string) (*datastore.UserInfo, error)
	// CreateUserAndOrg creates a user and org for creating a new org with specified user as owner.
	CreateUserAndOrg(*datastore.OrgInfo, *datastore.UserInfo) (orgID uuid.UUID, userID uuid.UUID, err error)
	// UpdateUser updates the user info.
	UpdateUser(*datastore.UserInfo) error
	// DeleteUser deletes the user.
	DeleteUser(uuid.UUID) error
}

UserDatastore is the interface used to the backing store for user profile information.

type UserSettingsDatastore

type UserSettingsDatastore interface {
	// GetUserSettings gets the user settings for the given user and keys.
	GetUserSettings(uuid.UUID) (*datastore.UserSettings, error)
	// UpdateUserSettings updates the keys and values for the given user.
	UpdateUserSettings(*datastore.UserSettings) error
	// GetUserAttributes gets the attributes for the given user.
	GetUserAttributes(uuid.UUID) (*datastore.UserAttributes, error)
	// SetUserAttributes sets the attributes for the given user.
	SetUserAttributes(*datastore.UserAttributes) error
}

UserSettingsDatastore is the interface used to the backing store for user settings.

Directories

Path Synopsis
Package mock_controllers is a generated GoMock package.
Package mock_controllers is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL