domains

package
v0.0.0-...-002919c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2024 License: MIT Imports: 22 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ACLAllow

func ACLAllow(method, uri string, roleIDs []string, apiDef *openapi3.T) bool

ACLAllow ロールに沿ったAPIアクセス許可チェック

func AddRoleForUser

func AddRoleForUser(userID, roleID string) bool

AddRoleForUser ユーザーにロールを付与する

func CountAdminUser

func CountAdminUser(ctx context.Context) int

CountAdminUser adminUserレコード数をカウント

func CreateAuditLog

func CreateAuditLog(ctx context.Context, audit *AuditLog) error

func CreatePermissionsForRole

func CreatePermissionsForRole(roleID string, permissions []*AdminRolePermission) *errors.VironError

CreatePermissionsForRole ロールの権限を作成する

func CreateViewerRole

func CreateViewerRole(apiDef *openapi3.T) error

CreateViewerRole viewerロールを作成

func GetOas

func GetOas(apiDef *openapi3.T, roleIDs []string) *openapi3.T

GetOas ロールに沿ったoasを返す

func ListResourcesByOas

func ListResourcesByOas(apiDef *openapi3.T) []string

ListResourcesByOas resource一覧

func NewFile

func NewFile(filePath string) error

func NewMongo

func NewMongo(opt *options.ClientOptions, dbName string, collectionName string) error

func NewMySQL

func NewMySQL(conn *sql.DB) error

func RemoveAdminRoleOne

func RemoveAdminRoleOne(roleID string) *errors.VironError

RemoveAdminRoleOne IDで1件削除

func RemoveAdminUserById

func RemoveAdminUserById(ctx context.Context, id string) *errors.VironError

func RevokePermissionForRole

func RevokePermissionForRole(roleID, resourceID string, permissions []string) bool

RevekePermissionForRole ロールから権限を剥奪する

func RevokeRoleForUser

func RevokeRoleForUser(userID, roleID string) bool

RevekeRoleForUser ユーザーからロールを剥奪する

func SetLoadPolicyInterval

func SetLoadPolicyInterval(sec int64)

func UpdateAccountByID

func UpdateAccountByID(ctx context.Context, userID string, payload *AdminAccount) error

UpdateAccountByID IDで1件更新

func UpdateAdminRoleByID

func UpdateAdminRoleByID(roleID string, permissions []*AdminRolePermission) *errors.VironError

UpdateAdminRoleByID IDで1件更新

func UpdateAdminUserByID

func UpdateAdminUserByID(ctx context.Context, id string, payload *AdminUser) *errors.VironError

UpdateAdminUserByID IDで1件更新

func UpdatePermissionsForRole

func UpdatePermissionsForRole(roleID string, permissions []*AdminRolePermission) *errors.VironError

UpdatePermissionsForRole ロールの権限を更新する

func ValidateRoleAndPermissions

func ValidateRoleAndPermissions(roleID string, permissions []*AdminRolePermission) *errors.VironError

Types

type Action

type Action struct {
	OperationID string `json:"operationId"`
}

type AdminAccount

type AdminAccount struct {
	ID       string   `json:"id"`
	Email    string   `json:"email"`
	AuthType string   `json:"type"`
	Password *string  `json:"password"`
	Salt     *string  `json:"salt"`
	RoleIDs  []string `json:"roleIds"`
}

type AdminAccountsWithPager

type AdminAccountsWithPager struct {
	Pager
	List []*AdminAccount `json:"list"`
}

func ListAccountByID

func ListAccountByID(ctx context.Context, userID string) *AdminAccountsWithPager

ListAccountByID 一覧取得(idを指定するので結果は必ず1件)

type AdminRole

type AdminRole struct {
	ID          string                 `json:"id"`
	Permissions []*AdminRolePermission `json:"permissions,omitempty"`
}

func CreateAdminRoleOne

func CreateAdminRoleOne(role *AdminRole) (*AdminRole, *errors.VironError)

CreateAdminRoleOne 1件作成

type AdminRolePermission

type AdminRolePermission struct {
	ResourceID string `json:"resourceId"`
	Permission string `json:"permission"`
}

type AdminRolesWithPager

type AdminRolesWithPager struct {
	Pager
	List []*AdminRole `json:"list"`
}

func ListByOas

func ListByOas(apiDef *openapi3.T, page, size int) *AdminRolesWithPager

ListByOas 管理ロール一覧

type AdminUser

type AdminUser struct {
	ID                       string    `json:"id"`
	Email                    string    `json:"email"`
	AuthType                 string    `json:"authType"`
	Password                 *string   `json:"password,omitempty"`
	Salt                     *string   `json:"salt,omitempty"`
	GoogleOAuth2AccessToken  *string   `json:"googleOAuth2AccessToken,omitempty"`
	GoogleOAuth2ExpiryDate   *uint64   `json:"googleOAuth2ExpiryDate,omitempty"`
	GoogleOAuth2IdToken      *string   `json:"googleOAuth2IdToken,omitempty"`
	GoogleOAuth2RefreshToken *string   `json:"googleOAuth2RefreshToken,omitempty"`
	GoogleOAuth2TokenType    *string   `json:"googleOAuth2TokenType,omitempty"`
	RoleIDs                  []string  `json:"roleIds"`
	CreatedAt                time.Time `json:"createdAt"`
	UpdatedAt                time.Time `json:"updatedAt"`
}

func CreateAdminUser

func CreateAdminUser(ctx context.Context, payload *AdminUser, authType string) (*AdminUser, *errors.VironError)

CreateAdminUser adminUser insert

func FindByEmail

func FindByEmail(ctx context.Context, email string) *AdminUser

FindByEmail emailで1件取得

func FindByID

func FindByID(ctx context.Context, userID string) *AdminUser

FindByID IDで1件取得

type AdminUserConditions

type AdminUserConditions struct {
	ID       string
	Email    string
	AuthType string
	RoleID   string
	Size     int
	Page     int
	Sort     []string
}

type AdminUsersWithPager

type AdminUsersWithPager struct {
	Pager
	List []*AdminUser `json:"list"`
}

func ListAdminUser

func ListAdminUser(ctx context.Context, opts *AdminUserConditions) (*AdminUsersWithPager, error)

ListAdminUser 一覧取得

type AuditLog

type AuditLog struct {
	ID            string    `json:"id"`
	RequestMethod *string   `json:"requestMethod,omitempty"`
	RequestUri    *string   `json:"requestUri,omitempty"`
	SourceIp      *string   `json:"sourceIp,omitempty"`
	UserId        *string   `json:"userId,omitempty"`
	RequestBody   *string   `json:"requestBody,omitempty"`
	StatusCode    *int      `json:"statusCode,omitempty"`
	CreatedAt     time.Time `json:"createdAt"`
	UpdatedAt     time.Time `json:"updatedAt"`
}

type AuditLogsWithPager

type AuditLogsWithPager struct {
	Pager
	List []*AuditLog `json:"list"`
}

func ListAuditLog

func ListAuditLog(ctx context.Context, audit *AuditLog, page, size int, sort []string) *AuditLogsWithPager

type AuthConfig

type AuthConfig struct {
	Provider                string      `json:"provider"`
	AuthConfigType          string      `json:"type"`
	OperationID             string      `json:"operationId"`
	DefaultParametersValue  interface{} `json:"defaultParametersValue,omitempty"`
	DefaultRequestBodyValue interface{} `json:"defaultRequestBodyValue,omitempty"`
}

func GenAuthConfig

func GenAuthConfig(provider string, authConfigType string, method string, path string, apiDef *openapi3.T) (*AuthConfig, *openapi3.PathItem, *errors.VironError)

type Content

type Content struct {
	OperationID string    `json:"operationId"`
	Query       []string  `json:"query,omitempty"`
	Sort        []string  `json:"sort,omitempty"`
	ResourceID  string    `json:"resourceId"`
	ContentType string    `json:"type"`
	Actions     []*Action `json:"actions"`
}

type Pager

type Pager struct {
	CurrentPage int  `json:"currentPage"`
	MaxPage     int  `json:"maxPage"`
	Start       *int `json:"-"`
	End         *int `json:"-"`
}

Pager is common pager struct for viron

func Paging

func Paging(listNum, size, page int) Pager

type Permission

type Permission struct {
	ResourceID   string
	OperationIDs []string
}

type XPage

type XPage struct {
	ID          string     `json:"id"`
	Title       string     `json:"title"`
	Group       string     `json:"group"`
	Description string     `json:"description"`
	Contents    []*Content `json:"contents"`
}

type XPages

type XPages []*XPage

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL