Documentation
¶
Index ¶
- type ConfigDatabase
- type DataLoader
- type Database
- func (d *Database) Close() error
- func (d *Database) DeleteInvite(ctx context.Context, criteria Invite) error
- func (d *Database) DeleteInvitesForEmail(ctx context.Context, tenantID, email string) error
- func (d *Database) GetGormDB() *gorm.DB
- func (d *Database) GetInvitesForEmail(ctx context.Context, tenantID, email string) ([]Invite, error)
- func (d *Database) GetInvitesForEntity(ctx context.Context, tenantID, entityType, entityID string) ([]Invite, error)
- func (d *Database) GetOrCreateUser(ctx context.Context, tenantID string, input graph.UserInput) (*graph.User, error)
- func (d *Database) GetRolesByTechnicalNames(ctx context.Context, entityType string, technicalNames []string) ([]*Role, error)
- func (d *Database) GetRolesForEntity(ctx context.Context, entityType string, entityID string) ([]Role, error)
- func (d *Database) GetTenantConfigurationByIssuerAndAudience(ctx context.Context, issuer string, audiences []string) (*TenantConfiguration, error)
- func (d *Database) GetTenantConfigurationForContext(ctx context.Context) (*TenantConfiguration, error)
- func (d *Database) GetUserByEmail(ctx context.Context, tenantID string, email string) (*graph.User, error)
- func (d *Database) GetUserByID(ctx context.Context, tenantID string, userID string) (*graph.User, error)
- func (d *Database) GetUserHooks() UserHooks
- func (d *Database) GetUsers(ctx context.Context, tenantID string, limit int, page int) (*graph.UserConnection, error)
- func (d *Database) GetUsersByUserIDs(ctx context.Context, tenantID string, userIDs []string, limit, page int, ...) ([]*graph.User, error)
- func (d *Database) InviteUser(ctx context.Context, tenantID string, invite graph.Invite, notifyByEmail bool) error
- func (d *Database) LoadInvitationData(filePath string) error
- func (d *Database) LoadRoleData(filePath string) error
- func (d *Database) LoadTeamData(filePath string, users []*graph.User) error
- func (d *Database) LoadTenantConfigData(filePath string) error
- func (d *Database) LoadUserData(filePath string) ([]*graph.User, error)
- func (d *Database) RemoveRoleFromInvite(ctx context.Context, criteria Invite, roleToDelete string) error
- func (d *Database) RemoveUser(ctx context.Context, tenantID string, userID string, email string) (bool, error)
- func (d *Database) Save(user *graph.User) error
- func (d *Database) SearchUsers(ctx context.Context, tenantId, query string) ([]*graph.User, error)
- func (d *Database) SetConfig(cfg ConfigDatabase)
- func (d *Database) SetUserHooks(hooks UserHooks)
- type DatabaseLocalData
- type Invite
- type InviteList
- type Role
- type Service
- type TeamList
- type TenantConfiguration
- type TenantConfigurationsList
- type User
- type UserHooks
- type UserList
- type UserService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigDatabase ¶
type ConfigDatabase struct {
InMemory bool `envconfig:"default=true"`
DSN string `envconfig:"optional"`
User string `envconfig:"default=admin"`
Name string `envconfig:"default=aname"`
SSLMode string `envconfig:"default=disable"`
Password string `envconfig:"default=apassword"`
IP string `envconfig:"optional"`
Instance string `envconfig:"default=iam-service"`
InstanceNamespace string `envconfig:"default=dxp-system"`
SSLCertName string `envconfig:"default=iam-service"`
SSLCertNamespace string `envconfig:"default=dxp-system"`
TmpDir string `envconfig:"default='.'"`
MaxIdleConns int `envconfig:"default=5"`
MaxOpenConns int `envconfig:"default=20"`
MaxConnLifetime string `envconfig:"default=30m"`
LocalData DatabaseLocalData
MaxSearchUsersLimit int `envconfig:"default=5"` // defines the maximum number of users to return in a search
MaxSearchUsersTimeout int `envconfig:"default=5"` // defines the maximum time to wait for a search to complete
}
type DataLoader ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database defines a connection to a DB
func New ¶
func New(cfg ConfigDatabase, dbConn *gorm.DB, logger *logger.Logger, migrate bool, isLocal bool) (*Database, error)
New returns an initialized Database struct
func (*Database) DeleteInvite ¶
func (*Database) DeleteInvitesForEmail ¶
func (*Database) GetInvitesForEmail ¶
func (*Database) GetInvitesForEntity ¶
func (*Database) GetOrCreateUser ¶
func (*Database) GetRolesByTechnicalNames ¶
func (*Database) GetRolesForEntity ¶
func (*Database) GetTenantConfigurationByIssuerAndAudience ¶
func (*Database) GetTenantConfigurationForContext ¶
func (d *Database) GetTenantConfigurationForContext(ctx context.Context) (*TenantConfiguration, error)
func (*Database) GetUserByEmail ¶
func (d *Database) GetUserByEmail(ctx context.Context, tenantID string, email string) (*graph.User, error)
GetUserByEmail returns user by email
func (*Database) GetUserByID ¶
func (d *Database) GetUserByID(ctx context.Context, tenantID string, userID string) (*graph.User, error)
GetUserByID returns a member by ID
func (*Database) GetUserHooks ¶
func (*Database) GetUsers ¶
func (d *Database) GetUsers(ctx context.Context, tenantID string, limit int, page int) (*graph.UserConnection, error)
GetUsers returns all existing users for a tenant
func (*Database) GetUsersByUserIDs ¶
func (d *Database) GetUsersByUserIDs( ctx context.Context, tenantID string, userIDs []string, limit, page int, searchTerm *string, sortBy *graph.SortByInput, ) ([]*graph.User, error)
GetUsersByUserIDs returns a member by ID, limiting response to the current page contents and using a search filter for user_id, first_name, last_name and email
func (*Database) InviteUser ¶
func (*Database) LoadInvitationData ¶
func (*Database) LoadRoleData ¶
func (*Database) LoadTeamData ¶
func (*Database) LoadTenantConfigData ¶
TODO TenantContfig update / Delete not yet implemented.
func (*Database) LoadUserData ¶
func (*Database) RemoveRoleFromInvite ¶
func (*Database) RemoveUser ¶
func (d *Database) RemoveUser(ctx context.Context, tenantID string, userID string, email string) (bool, error)
RemoveUser removes user it returns true if user entry is no longer exists.
func (*Database) SearchUsers ¶
func (*Database) SetConfig ¶
func (d *Database) SetConfig(cfg ConfigDatabase)
func (*Database) SetUserHooks ¶
type DatabaseLocalData ¶
type DatabaseLocalData struct {
DataPathUser string `envconfig:"default=input/user.yaml"`
DataPathInvitations string `envconfig:"default=input/invitations.yaml"`
DataPathTeam string `envconfig:"default=input/team.yaml"`
DataPathTenantConfiguration string `envconfig:"default=input/tenantConfigurations.yaml"`
DataPathRoles string `envconfig:"optional"`
DataPathDomainConfiguration string `envconfig:"default=input/domainConfigurations.yaml"`
}
type InviteList ¶
type InviteList struct {
Invitations []Invite
}
type Role ¶
type Role struct {
gorm.Model
ID string `gorm:"type:uuid;primaryKey"`
DisplayName string `gorm:"not null"`
TechnicalName string `gorm:"not null;uniqueIndex:idx_technical_name_entity_type_entity_id"`
EntityType string `gorm:"not null;uniqueIndex:idx_technical_name_entity_type_entity_id"`
EntityID string `gorm:"uniqueIndex:idx_technical_name_entity_type_entity_id;default:''"`
}
type Service ¶
type Service interface {
UserService
Save(user *graph.User) error
Close() error
// tenant
GetTenantConfigurationForContext(ctx context.Context) (*TenantConfiguration, error)
// roles
GetRolesForEntity(ctx context.Context, entityType string, entityID string) ([]Role, error)
GetRolesByTechnicalNames(ctx context.Context, entityType string, technicalNames []string) ([]*Role, error)
}
type TenantConfiguration ¶
type TenantConfigurationsList ¶
type TenantConfigurationsList struct {
Configs []TenantConfiguration `json:"configs"`
}
type UserService ¶
type UserService interface {
GetUserByID(ctx context.Context, tenantID string, userId string) (*graph.User, error)
GetUsersByUserIDs(
ctx context.Context, tenantID string, userIDs []string, limit, page int, searchTerm *string,
sortBy *graph.SortByInput,
) ([]*graph.User, error)
GetUserByEmail(ctx context.Context, tenantID string, email string) (*graph.User, error)
GetOrCreateUser(ctx context.Context, tenantID string, input graph.UserInput) (*graph.User, error)
RemoveUser(ctx context.Context, tenantID string, userId string, email string) (bool, error)
GetUsers(ctx context.Context, tenantID string, limit int, page int) (*graph.UserConnection, error)
GetInvitesForEntity(ctx context.Context, tenantID, entityType, entityID string) ([]Invite, error)
RemoveRoleFromInvite(ctx context.Context, criteria Invite, roleToDelete string) error
DeleteInvite(ctx context.Context, criteria Invite) error
InviteUser(ctx context.Context, tenantID string, invite graph.Invite, notifyByEmail bool) error
SearchUsers(ctx context.Context, tenantID, query string) ([]*graph.User, error)
// hooks
SetUserHooks(hooks UserHooks)
GetUserHooks() UserHooks
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.