Versions in this module Expand all Collapse all v0 v0.0.2 Jun 1, 2021 v0.0.1 Jun 1, 2021 Changes in this version + var ErrInvalidConfig = errors.New("invalid config") + func AddIdentity(ctx context.Context, identity *domain.Identity) error + func AddNamespace(ctx context.Context, namespace *domain.Namespace) error + func AddRole(ctx context.Context, role *domain.Role) error + func AddRule(ctx context.Context, rule *domain.Rule) error + func AddSession(ctx context.Context, session *domain.Session) error + func AddUser(ctx context.Context, user *domain.User) error + func GetIdentity(ctx context.Context, identityID uint) (*domain.Identity, error) + func GetIdentityByName(ctx context.Context, namespace, name string) (*domain.Identity, error) + func GetIdentityByUserPass(ctx context.Context, namespace string, username string, password string) (*domain.Identity, error) + func GetNamespace(ctx context.Context, namespaceID uint) (*domain.Namespace, error) + func GetNamespaceByName(ctx context.Context, name string) (*domain.Namespace, error) + func GetNamespaceFromIdentity(ctx context.Context, identityId uint) (*domain.Namespace, error) + func GetRole(ctx context.Context, roleID uint) (*domain.Role, error) + func GetRoleByName(ctx context.Context, namespace string, name string) (*domain.Role, error) + func GetRule(ctx context.Context, ruleID uint) (*domain.Rule, error) + func GetRuleByName(ctx context.Context, namespace string, name string) (*domain.Rule, error) + func GetSession(ctx context.Context, sessionID uint) (*domain.Session, error) + func GetSessionFromIdentity(ctx context.Context, identityID uint) (*domain.Session, error) + func GetSoidConfig(ctx context.Context) (*domain.SOIDConfig, error) + func GetUser(ctx context.Context, userID uint) (*domain.User, error) + func GetUserByName(ctx context.Context, namespace string, name string) (*domain.User, error) + func GetUserFromIdentity(ctx context.Context, identityId uint) (*domain.User, error) + func InitializeDefaultRepo(cfgFile string) error + func RemoveIdentity(ctx context.Context, identityID uint) error + func RemoveNamespace(ctx context.Context, namespaceID uint) error + func RemoveRole(ctx context.Context, roleID uint) error + func RemoveRule(ctx context.Context, ruleID uint) error + func RemoveSession(ctx context.Context, sessionID uint) error + func RemoveUser(ctx context.Context, userID uint) error + func SetSoidConfig(ctx context.Context, cfg *domain.SOIDConfig) error + func UpdateIdentity(ctx context.Context, identity *domain.Identity) error + func UpdateNamespace(ctx context.Context, namespace *domain.Namespace) error + func UpdateRole(ctx context.Context, role *domain.Role) error + func UpdateRule(ctx context.Context, rule *domain.Rule) error + func UpdateSession(ctx context.Context, session *domain.Session) error + func UpdateUser(ctx context.Context, user *domain.User) error + type FileSoidConfigRepo struct + func (r *FileSoidConfigRepo) GetSoidConfig(ctx context.Context) (*domain.SOIDConfig, error) + func (r *FileSoidConfigRepo) SetSoidConfig(ctx context.Context, cfg *domain.SOIDConfig) error + type IdentityRepo interface + AddIdentity func(ctx context.Context, identity *domain.Identity) error + GetIdentity func(ctx context.Context, identityID uint) (*domain.Identity, error) + GetIdentityByName func(ctx context.Context, namespace, name string) (*domain.Identity, error) + GetIdentityByUserPass func(ctx context.Context, namespace string, username string, password string) (*domain.Identity, error) + ListIdentities func(ctx context.Context, query string, queryParams []interface{}, orderBy string, ...) (*ListIdentitiesResult, error) + Migrate func() error + RemoveIdentity func(ctx context.Context, identityID uint) error + UpdateIdentity func(ctx context.Context, identity *domain.Identity) error + func NewSQLIdentityRepo(db *gorm.DB) IdentityRepo + type ListIdentitiesResult struct + Identities []*domain.Identity + NextPageToken string + TotalSize int64 + func ListIdentities(ctx context.Context, query string, queryParams []interface{}, orderBy string, ...) (*ListIdentitiesResult, error) + type ListNamespacesResult struct + Namespaces []*domain.Namespace + NextPageToken string + TotalSize int64 + func ListNamespaces(ctx context.Context, query string, queryParams []interface{}, orderBy string, ...) (*ListNamespacesResult, error) + type ListRolesResult struct + NextPageToken string + Roles []*domain.Role + TotalSize int64 + func ListRoles(ctx context.Context, query string, queryParams []interface{}, orderBy string, ...) (*ListRolesResult, error) + type ListRulesResult struct + NextPageToken string + Rules []*domain.Rule + TotalSize int64 + func ListRules(ctx context.Context, query string, queryParams []interface{}, orderBy string, ...) (*ListRulesResult, error) + type ListSessionsResult struct + NextPageToken string + Sessions []*domain.Session + TotalSize int64 + func ListSessions(ctx context.Context, query string, queryParams []interface{}, orderBy string, ...) (*ListSessionsResult, error) + type ListUsersResult struct + NextPageToken string + TotalSize int64 + Users []*domain.User + func ListUsers(ctx context.Context, query string, queryParams []interface{}, orderBy string, ...) (*ListUsersResult, error) + type NamespaceRepo interface + AddNamespace func(ctx context.Context, namespace *domain.Namespace) error + GetNamespace func(ctx context.Context, namespaceID uint) (*domain.Namespace, error) + GetNamespaceByName func(ctx context.Context, name string) (*domain.Namespace, error) + GetNamespaceFromIdentity func(ctx context.Context, identityID uint) (*domain.Namespace, error) + ListNamespaces func(ctx context.Context, query string, queryParams []interface{}, orderBy string, ...) (*ListNamespacesResult, error) + Migrate func() error + RemoveNamespace func(ctx context.Context, namespaceID uint) error + UpdateNamespace func(ctx context.Context, namespace *domain.Namespace) error + func NewSQLNamespaceRepo(db *gorm.DB) NamespaceRepo + type Query struct + OrderBy string + Page int + PageSize int + Query string + QueryParams []interface{} + func FromToken(token string, preload string) (*Query, error) + func NewQuery(query string, queryParams []interface{}, orderBy string, pageSize int, ...) *Query + func (q *Query) Exec(db *gorm.DB, result interface{}, totalCount *int64) error + func (q *Query) IsCompatibleWith(other *Query) bool + func (q *Query) List(db *gorm.DB, result interface{}, totalCount *int64) (*Query, error) + func (q *Query) ToToken() (string, error) + type RoleRepo interface + AddRole func(ctx context.Context, role *domain.Role) error + GetRole func(ctx context.Context, roleID uint) (*domain.Role, error) + GetRoleByName func(ctx context.Context, namespace string, name string) (*domain.Role, error) + ListRoles func(ctx context.Context, query string, queryParams []interface{}, orderBy string, ...) (*ListRolesResult, error) + Migrate func() error + RemoveRole func(ctx context.Context, roleID uint) error + UpdateRole func(ctx context.Context, role *domain.Role) error + type RuleRepo interface + AddRule func(ctx context.Context, rule *domain.Rule) error + FindRulesForName func(ctx context.Context, namespace string, name string) ([]*domain.Rule, error) + GetRule func(ctx context.Context, ruleID uint) (*domain.Rule, error) + GetRuleByName func(ctx context.Context, namespace string, name string) (*domain.Rule, error) + ListRules func(ctx context.Context, query string, queryParams []interface{}, orderBy string, ...) (*ListRulesResult, error) + Migrate func() error + RemoveRule func(ctx context.Context, ruleID uint) error + UpdateRule func(ctx context.Context, rule *domain.Rule) error + func NewSQLRuleRepo(db *gorm.DB) RuleRepo + type SOIDConfigRepo interface + GetSoidConfig func(ctx context.Context) (*domain.SOIDConfig, error) + SetSoidConfig func(ctx context.Context, cfg *domain.SOIDConfig) error + func NewFileSoidConfigRepo(filePath string) (SOIDConfigRepo, error) + type SQLIdentityRepo struct + func (r *SQLIdentityRepo) AddIdentity(ctx context.Context, identity *domain.Identity) error + func (r *SQLIdentityRepo) GetIdentity(ctx context.Context, identityID uint) (*domain.Identity, error) + func (r *SQLIdentityRepo) GetIdentityByName(ctx context.Context, namespace, name string) (*domain.Identity, error) + func (r *SQLIdentityRepo) GetIdentityByUserPass(ctx context.Context, namespace string, username string, password string) (*domain.Identity, error) + func (r *SQLIdentityRepo) ListIdentities(ctx context.Context, query string, queryParams []interface{}, orderBy string, ...) (*ListIdentitiesResult, error) + func (r *SQLIdentityRepo) Migrate() error + func (r *SQLIdentityRepo) RemoveIdentity(ctx context.Context, identityID uint) error + func (r *SQLIdentityRepo) UpdateIdentity(ctx context.Context, identity *domain.Identity) error + type SQLNamespaceRepo struct + func (r *SQLNamespaceRepo) AddNamespace(ctx context.Context, namespace *domain.Namespace) error + func (r *SQLNamespaceRepo) GetNamespace(ctx context.Context, namespaceID uint) (*domain.Namespace, error) + func (r *SQLNamespaceRepo) GetNamespaceByName(ctx context.Context, name string) (*domain.Namespace, error) + func (r *SQLNamespaceRepo) GetNamespaceFromIdentity(ctx context.Context, identityId uint) (*domain.Namespace, error) + func (r *SQLNamespaceRepo) ListNamespaces(ctx context.Context, query string, queryParams []interface{}, orderBy string, ...) (*ListNamespacesResult, error) + func (r *SQLNamespaceRepo) Migrate() error + func (r *SQLNamespaceRepo) RemoveNamespace(ctx context.Context, namespaceID uint) error + func (r *SQLNamespaceRepo) UpdateNamespace(ctx context.Context, namespace *domain.Namespace) error + type SQLRepository struct + func GetDefaultRepo() *SQLRepository + func NewSqlRepository(soidCfgFile string) (*SQLRepository, error) + func (r *SQLRepository) DB() *gorm.DB + func (r *SQLRepository) Identities() IdentityRepo + func (r *SQLRepository) Migrate() error + func (r *SQLRepository) Namespaces() NamespaceRepo + func (r *SQLRepository) Roles() RoleRepo + func (r *SQLRepository) Rules() RuleRepo + func (r *SQLRepository) SOIDConfig() SOIDConfigRepo + func (r *SQLRepository) Sessions() SessionRepo + func (r *SQLRepository) Users() UserRepo + type SQLRoleRepo struct + func NewSQLRoleRepo(db *gorm.DB) *SQLRoleRepo + func (r *SQLRoleRepo) AddRole(ctx context.Context, role *domain.Role) error + func (r *SQLRoleRepo) GetRole(ctx context.Context, roleID uint) (*domain.Role, error) + func (r *SQLRoleRepo) GetRoleByName(ctx context.Context, namespace string, name string) (*domain.Role, error) + func (r *SQLRoleRepo) ListRoles(ctx context.Context, query string, queryParams []interface{}, orderBy string, ...) (*ListRolesResult, error) + func (r *SQLRoleRepo) Migrate() error + func (r *SQLRoleRepo) RemoveRole(ctx context.Context, roleID uint) error + func (r *SQLRoleRepo) UpdateRole(ctx context.Context, role *domain.Role) error + type SQLRuleRepo struct + func (r *SQLRuleRepo) AddRule(ctx context.Context, rule *domain.Rule) error + func (r *SQLRuleRepo) FindRulesForName(ctx context.Context, namespace string, name string) ([]*domain.Rule, error) + func (r *SQLRuleRepo) GetRule(ctx context.Context, ruleID uint) (*domain.Rule, error) + func (r *SQLRuleRepo) GetRuleByName(ctx context.Context, namespace string, name string) (*domain.Rule, error) + func (r *SQLRuleRepo) ListRules(ctx context.Context, query string, queryParams []interface{}, orderBy string, ...) (*ListRulesResult, error) + func (r *SQLRuleRepo) Migrate() error + func (r *SQLRuleRepo) RemoveRule(ctx context.Context, ruleID uint) error + func (r *SQLRuleRepo) UpdateRule(ctx context.Context, rule *domain.Rule) error + type SQLSessionRepo struct + func (r *SQLSessionRepo) AddSession(ctx context.Context, session *domain.Session) error + func (r *SQLSessionRepo) GetSession(ctx context.Context, sessionID uint) (*domain.Session, error) + func (r *SQLSessionRepo) GetSessionFromIdentity(ctx context.Context, identityId uint) (*domain.Session, error) + func (r *SQLSessionRepo) ListSessions(ctx context.Context, query string, queryParams []interface{}, orderBy string, ...) (*ListSessionsResult, error) + func (r *SQLSessionRepo) Migrate() error + func (r *SQLSessionRepo) RemoveSession(ctx context.Context, sessionID uint) error + func (r *SQLSessionRepo) UpdateSession(ctx context.Context, session *domain.Session) error + type SQLUserRepo struct + func (r *SQLUserRepo) AddUser(ctx context.Context, user *domain.User) error + func (r *SQLUserRepo) GetUser(ctx context.Context, userID uint) (*domain.User, error) + func (r *SQLUserRepo) GetUserByName(ctx context.Context, namespace, name string) (*domain.User, error) + func (r *SQLUserRepo) GetUserFromIdentity(ctx context.Context, identityId uint) (*domain.User, error) + func (r *SQLUserRepo) ListUsers(ctx context.Context, query string, queryParams []interface{}, orderBy string, ...) (*ListUsersResult, error) + func (r *SQLUserRepo) Migrate() error + func (r *SQLUserRepo) RemoveUser(ctx context.Context, userID uint) error + func (r *SQLUserRepo) UpdateUser(ctx context.Context, user *domain.User) error + type SessionRepo interface + AddSession func(ctx context.Context, session *domain.Session) error + GetSession func(ctx context.Context, sessionID uint) (*domain.Session, error) + GetSessionFromIdentity func(ctx context.Context, identityID uint) (*domain.Session, error) + ListSessions func(ctx context.Context, query string, queryParams []interface{}, orderBy string, ...) (*ListSessionsResult, error) + Migrate func() error + RemoveSession func(ctx context.Context, sessionID uint) error + UpdateSession func(ctx context.Context, session *domain.Session) error + func NewSQLSessionRepo(db *gorm.DB) SessionRepo + type UserRepo interface + AddUser func(ctx context.Context, user *domain.User) error + GetUser func(ctx context.Context, userID uint) (*domain.User, error) + GetUserByName func(ctx context.Context, namespace, name string) (*domain.User, error) + GetUserFromIdentity func(ctx context.Context, identityID uint) (*domain.User, error) + ListUsers func(ctx context.Context, query string, queryParams []interface{}, orderBy string, ...) (*ListUsersResult, error) + Migrate func() error + RemoveUser func(ctx context.Context, userID uint) error + UpdateUser func(ctx context.Context, user *domain.User) error + func NewSQLUserRepo(db *gorm.DB) UserRepo