Documentation ¶
Index ¶
- Constants
- type OrgDatastore
- type OrgSettingsDatastore
- type Server
- func (s *Server) AddOrgIDEConfig(ctx context.Context, req *profilepb.AddOrgIDEConfigRequest) (*profilepb.AddOrgIDEConfigResponse, error)
- func (s *Server) CreateInviteToken(ctx context.Context, req *profilepb.CreateInviteTokenRequest) (*profilepb.InviteToken, error)
- func (s *Server) CreateOrg(ctx context.Context, req *profilepb.CreateOrgRequest) (*uuidpb.UUID, error)
- func (s *Server) CreateOrgAndUser(ctx context.Context, req *profilepb.CreateOrgAndUserRequest) (*profilepb.CreateOrgAndUserResponse, error)
- func (s *Server) CreateUser(ctx context.Context, req *profilepb.CreateUserRequest) (*uuidpb.UUID, error)
- func (s *Server) DeleteOrgAndUsers(ctx context.Context, req *uuidpb.UUID) error
- func (s *Server) DeleteOrgIDEConfig(ctx context.Context, req *profilepb.DeleteOrgIDEConfigRequest) (*profilepb.DeleteOrgIDEConfigResponse, error)
- func (s *Server) DeleteUser(ctx context.Context, req *profilepb.DeleteUserRequest) (*profilepb.DeleteUserResponse, error)
- func (s *Server) GetOrg(ctx context.Context, req *uuidpb.UUID) (*profilepb.OrgInfo, error)
- func (s *Server) GetOrgByDomain(ctx context.Context, req *profilepb.GetOrgByDomainRequest) (*profilepb.OrgInfo, error)
- func (s *Server) GetOrgByName(ctx context.Context, req *profilepb.GetOrgByNameRequest) (*profilepb.OrgInfo, error)
- func (s *Server) GetOrgIDEConfigs(ctx context.Context, req *profilepb.GetOrgIDEConfigsRequest) (*profilepb.GetOrgIDEConfigsResponse, error)
- func (s *Server) GetOrgs(ctx context.Context, req *profilepb.GetOrgsRequest) (*profilepb.GetOrgsResponse, error)
- func (s *Server) GetUser(ctx context.Context, req *uuidpb.UUID) (*profilepb.UserInfo, error)
- func (s *Server) GetUserAttributes(ctx context.Context, req *profilepb.GetUserAttributesRequest) (*profilepb.GetUserAttributesResponse, error)
- func (s *Server) GetUserByAuthProviderID(ctx context.Context, req *profilepb.GetUserByAuthProviderIDRequest) (*profilepb.UserInfo, error)
- func (s *Server) GetUserByEmail(ctx context.Context, req *profilepb.GetUserByEmailRequest) (*profilepb.UserInfo, error)
- func (s *Server) GetUserSettings(ctx context.Context, req *profilepb.GetUserSettingsRequest) (*profilepb.GetUserSettingsResponse, error)
- func (s *Server) GetUsersInOrg(ctx context.Context, req *profilepb.GetUsersInOrgRequest) (*profilepb.GetUsersInOrgResponse, error)
- func (s *Server) RevokeAllInviteTokens(ctx context.Context, req *uuidpb.UUID) (*types.Empty, error)
- func (s *Server) SetUserAttributes(ctx context.Context, req *profilepb.SetUserAttributesRequest) (*profilepb.SetUserAttributesResponse, error)
- func (s *Server) UpdateOrg(ctx context.Context, req *profilepb.UpdateOrgRequest) (*profilepb.OrgInfo, error)
- func (s *Server) UpdateUser(ctx context.Context, req *profilepb.UpdateUserRequest) (*profilepb.UserInfo, error)
- func (s *Server) UpdateUserSettings(ctx context.Context, req *profilepb.UpdateUserSettingsRequest) (*profilepb.UpdateUserSettingsResponse, error)
- func (s *Server) VerifyInviteToken(ctx context.Context, req *profilepb.InviteToken) (*profilepb.VerifyInviteTokenResponse, error)
- type UserDatastore
- type UserSettingsDatastore
Constants ¶
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 ¶
func NewServer(env profileenv.ProfileEnv, uds UserDatastore, usds UserSettingsDatastore, ods OrgDatastore, osds OrgSettingsDatastore) *Server
NewServer creates a new GRPC profile server.
func (*Server) AddOrgIDEConfig ¶
func (s *Server) AddOrgIDEConfig(ctx context.Context, req *profilepb.AddOrgIDEConfigRequest) (*profilepb.AddOrgIDEConfigResponse, error)
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 ¶
func (s *Server) CreateOrgAndUser(ctx context.Context, req *profilepb.CreateOrgAndUserRequest) (*profilepb.CreateOrgAndUserResponse, error)
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 ¶
DeleteOrgAndUsers deletes an org and all of its users.
func (*Server) DeleteOrgIDEConfig ¶
func (s *Server) DeleteOrgIDEConfig(ctx context.Context, req *profilepb.DeleteOrgIDEConfigRequest) (*profilepb.DeleteOrgIDEConfigResponse, error)
DeleteOrgIDEConfig deletes the IDE config from the given org.
func (*Server) DeleteUser ¶
func (s *Server) DeleteUser(ctx context.Context, req *profilepb.DeleteUserRequest) (*profilepb.DeleteUserResponse, error)
DeleteUser deletes a user. If they are the last user in the org, also deletes the org.
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 ¶
func (s *Server) GetOrgIDEConfigs(ctx context.Context, req *profilepb.GetOrgIDEConfigsRequest) (*profilepb.GetOrgIDEConfigsResponse, error)
GetOrgIDEConfigs gets all IDE configs from the given org.
func (*Server) GetOrgs ¶
func (s *Server) GetOrgs(ctx context.Context, req *profilepb.GetOrgsRequest) (*profilepb.GetOrgsResponse, error)
GetOrgs is the GRPC method to get all orgs. This should only be used internally.
func (*Server) GetUserAttributes ¶
func (s *Server) GetUserAttributes(ctx context.Context, req *profilepb.GetUserAttributesRequest) (*profilepb.GetUserAttributesResponse, error)
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 ¶
func (s *Server) GetUserSettings(ctx context.Context, req *profilepb.GetUserSettingsRequest) (*profilepb.GetUserSettingsResponse, error)
GetUserSettings gets the user settings for the given user.
func (*Server) GetUsersInOrg ¶
func (s *Server) GetUsersInOrg(ctx context.Context, req *profilepb.GetUsersInOrgRequest) (*profilepb.GetUsersInOrgResponse, error)
GetUsersInOrg gets the users in the requested org, given that the requestor has permissions.
func (*Server) RevokeAllInviteTokens ¶
RevokeAllInviteTokens revokes all pending invited for the given org by rotating the JWT signing key.
func (*Server) SetUserAttributes ¶
func (s *Server) SetUserAttributes(ctx context.Context, req *profilepb.SetUserAttributesRequest) (*profilepb.SetUserAttributesResponse, error)
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 ¶
func (s *Server) UpdateUser(ctx context.Context, req *profilepb.UpdateUserRequest) (*profilepb.UserInfo, error)
UpdateUser updates a user's info.
func (*Server) UpdateUserSettings ¶
func (s *Server) UpdateUserSettings(ctx context.Context, req *profilepb.UpdateUserSettingsRequest) (*profilepb.UpdateUserSettingsResponse, error)
UpdateUserSettings sets the user settings for the given user.
func (*Server) VerifyInviteToken ¶
func (s *Server) VerifyInviteToken(ctx context.Context, req *profilepb.InviteToken) (*profilepb.VerifyInviteTokenResponse, error)
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.