Skip to content
Snippets Groups Projects
rbacService.go 1.08 KiB
Newer Older
  • Learn to ignore specific revisions
  • package rbac
    
    import (
    	"code.fbi.h-da.de/danet/gosdn/controller/store"
    )
    
    // UserService describes an interface for user service implementation.
    type UserService interface {
    	Add(User) error
    	Delete(User) error
    	Update(User) error
    	Get(store.Query) (User, error)
    	GetAll() ([]User, error)
    }
    
    // LoadedUser represents a User that was loaded
    type LoadedUser struct {
    	ID       string            `json:"_id" bson:"_id"`
    	UserName string            `json:"username"`
    	Roles    map[string]string `json:"roles,omitempty"`
    	Password string            `json:"password"`
    	Token    string            `json:"token,omitempty"`
    }
    
    // RoleService describes an interface for role service implementations.
    type RoleService interface {
    	Add(Role) error
    	Delete(Role) error
    	Update(Role) error
    	Get(store.Query) (Role, error)
    	GetAll() ([]Role, error)
    }
    
    // LoadedRole represents a Role that was loaded
    type LoadedRole struct {
    	ID          string   `json:"_id" bson:"_id"`
    	RoleName    string   `json:"rolename"`
    	Description string   `json:"description,omitempty"`
    	Permissions []string `json:"permissions,omitempty"`
    }