Documentation
¶
Index ¶
- Variables
- type AuthServicer
- type Organization
- func (service *Organization) Create(organization *entities.Organization) error
- func (service *Organization) Delete(session Session) error
- func (service *Organization) GetUsers(session Session) ([]*entities.User, error)
- func (service *Organization) Page(session Session, pageQuery datastore.PageQuery) (datastore.PageResult[*entities.Organization], error)
- type OrganizationService
- type RoleService
- type RoleServicer
- type Service
- type ServiceSession
- func (session *ServiceSession) Close()
- func (session *ServiceSession) Error(err error)
- func (session *ServiceSession) IsMemberOfOrganization(organizationID uint64) bool
- func (session *ServiceSession) Logger() *logging.Logger
- func (session *ServiceSession) RequestedOrganizationID() uint64
- func (session *ServiceSession) RequestedServiceID() uint64
- func (session *ServiceSession) String() string
- func (session *ServiceSession) User() *entities.User
- type Session
- type User
- func (service *User) Activate(registrationID uint64) (*entities.User, error)
- func (service *User) CreateUser(user *entities.User) error
- func (service *User) Delete(session Session, userID uint64) error
- func (service *User) Get(userID uint64) (*entities.User, error)
- func (service *User) Login(userCredential *UserCredential) (*entities.User, []*entities.Organization, []*entities.Service, error)
- func (service *User) Refresh(userID uint64) (*entities.User, []*entities.Organization, []*entities.Service, error)
- func (service *User) Register(userCredential *UserCredential, baseURI string) (*entities.User, error)
- func (service *User) ResetPassword(userCredential *UserCredential) error
- func (service *User) UpdateUser(user *entities.User) error
- type UserCredential
- type UserServicer
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrCreateService = errors.New("service: failed to create service") ErrPermissionDenied = errors.New("service: permission denied") ErrDeleteAdminAccount = errors.New("service: admin account can't be deleted") ErrChangeAdminRole = errors.New("service: admin role can't be changed") ErrResetPasswordUnsupported = errors.New("service: reset password feature unsupported by auth store") )
View Source
var ( ErrUnsupportedAuthType = errors.New("unsupported auth type") ErrUserNotFound = errors.New("user not found") )
View Source
var (
ErrOrganizationNotFound = errors.New("organization not found")
)
View Source
var (
ErrRoleNotFound = errors.New("role not found")
)
Functions ¶
This section is empty.
Types ¶
type AuthServicer ¶
type AuthServicer interface {
Activate(registrationID uint64) (*entities.User, error)
Login(userCredentials *UserCredential) (*entities.User, []*entities.Organization, []*entities.Service, error)
Register(userCredentials *UserCredential, baseURI string) (*entities.User, error)
ResetPassword(userCredentials *UserCredential) error
}
type Organization ¶
type Organization struct {
OrganizationService
// contains filtered or unexported fields
}
func (*Organization) Create ¶
func (service *Organization) Create(organization *entities.Organization) error
Creates a new organization
func (*Organization) Delete ¶
func (service *Organization) Delete(session Session) error
Deletes an existing organization and all associated entites from the database
func (*Organization) GetUsers ¶
func (service *Organization) GetUsers(session Session) ([]*entities.User, error)
Returns a list of User entities that belong to the organization
func (*Organization) Page ¶
func (service *Organization) Page(session Session, pageQuery datastore.PageQuery) (datastore.PageResult[*entities.Organization], error)
Returns a list of User entities that belong to the organization
type OrganizationService ¶
type OrganizationService interface {
Create(organization *entities.Organization) error
Page(session Session, pageQuery datastore.PageQuery) (datastore.PageResult[*entities.Organization], error)
GetUsers(session Session) ([]*entities.User, error)
Delete(session Session) error
}
func NewOrganizationService ¶
func NewOrganizationService( logger *logging.Logger, orgDAO datastore.OrganizationDAO) OrganizationService
type RoleService ¶
type RoleService struct {
RoleServicer
// contains filtered or unexported fields
}
func (*RoleService) Page ¶
func (service *RoleService) Page(pageQuery datastore.PageQuery) (datastore.PageResult[*entities.Role], error)
Returns a list of all Role entities in the database
type RoleServicer ¶
type RoleServicer interface {
GetPage(pageQuery datastore.PageQuery) (datastore.PageResult[*entities.Role], error)
GetByName(name string, CONSISTENCY_LEVEL int) (*entities.Role, error)
}
func NewRoleService ¶
func NewRoleService( logger *logging.Logger, roleDAO datastore.RoleDAO) RoleServicer
type ServiceSession ¶
type ServiceSession struct {
Session
// contains filtered or unexported fields
}
func (*ServiceSession) Close ¶
func (session *ServiceSession) Close()
func (*ServiceSession) Error ¶
func (session *ServiceSession) Error(err error)
func (*ServiceSession) IsMemberOfOrganization ¶
func (session *ServiceSession) IsMemberOfOrganization(organizationID uint64) bool
func (*ServiceSession) Logger ¶
func (session *ServiceSession) Logger() *logging.Logger
func (*ServiceSession) RequestedOrganizationID ¶
func (session *ServiceSession) RequestedOrganizationID() uint64
func (*ServiceSession) RequestedServiceID ¶
func (session *ServiceSession) RequestedServiceID() uint64
func (*ServiceSession) String ¶
func (session *ServiceSession) String() string
func (*ServiceSession) User ¶
func (session *ServiceSession) User() *entities.User
type Session ¶
type User ¶
type User struct {
UserServicer
AuthServicer
// contains filtered or unexported fields
}
func (*User) CreateUser ¶
CreateUser creates a new user account
func (*User) Login ¶
func (service *User) Login(userCredential *UserCredential) (*entities.User, []*entities.Organization, []*entities.Service, error)
Login authenticates a user account against the AuthService
func (*User) Refresh ¶
func (service *User) Refresh(userID uint64) (*entities.User, []*entities.Organization, []*entities.Service, error)
Reloads the users organizations, services and permissions
func (*User) Register ¶
func (service *User) Register(userCredential *UserCredential, baseURI string) (*entities.User, error)
Register signs up a new account
func (*User) ResetPassword ¶
func (service *User) ResetPassword(userCredential *UserCredential) error
Sets a new user password
type UserCredential ¶
type UserServicer ¶
type UserServicer interface {
CreateUser(user *entities.User) error
UpdateUser(user *entities.User) error
Delete(session Session, userID uint64) error
// DeletePermission(session Session, userID uint64) error
Get(userID uint64) (*entities.User, error)
// SetPermission(session Session, permission *entities.Permission) error
// probably needs to be moved to auth service; not implemented in google_auth yet
// Refresh(userID uint64) (*entities.User, []*entities.Organization, []*entities.Service, error)
AuthServicer
}
func NewUserService ¶
func NewUserService( logger *logging.Logger, userDAO datastore.UserDAO, orgDAO datastore.OrganizationDAO, roleDAO datastore.RoleDAO, authServices map[int]AuthServicer) UserServicer
Click to show internal directories.
Click to hide internal directories.