29 lines
1.0 KiB
Go
29 lines
1.0 KiB
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
"omega-server/local/model"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// MembershipServiceInterface defines the interface for membership-related operations
|
|
type MembershipServiceInterface interface {
|
|
// Authentication and Authorization
|
|
Login(ctx context.Context, username, password string) (string, error)
|
|
HasPermission(ctx context.Context, userID string, permissionName string) (bool, error)
|
|
GetUserWithPermissions(ctx context.Context, userID string) (*model.User, error)
|
|
SetCacheInvalidator(invalidator CacheInvalidator)
|
|
|
|
// User Management
|
|
CreateUser(ctx context.Context, username, password, roleName string) (*model.User, error)
|
|
ListUsers(ctx context.Context) ([]*model.User, error)
|
|
GetUser(ctx context.Context, userID uuid.UUID) (*model.User, error)
|
|
DeleteUser(ctx context.Context, userID uuid.UUID) error
|
|
UpdateUser(ctx context.Context, userID uuid.UUID, req UpdateUserRequest) (*model.User, error)
|
|
|
|
// Role Management
|
|
GetAllRoles(ctx context.Context) ([]*model.Role, error)
|
|
SetupInitialData(ctx context.Context) error
|
|
}
|