model

package
v0.0.0-...-4024313 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteError

func WriteError(w http.ResponseWriter, error string, code int)

WriteError response

Types

type AddUser

type AddUser struct {
	UserEmail string `validate:"required"json:"user_email"`
}

Add user id

type ErrorResBody

type ErrorResBody struct {
	Code      int    `json:"code"`
	Title     string `json:"title"`
	Message   string `json:"message"`
	ErrorCode string `json:"error_code"`
}

GrantNZ error data

func BadRequest

func BadRequest(err ...string) *ErrorResBody

BadRequest

func Conflict

func Conflict(err ...string) *ErrorResBody

Conflict

func Forbidden

func Forbidden(err ...string) *ErrorResBody

Forbidden

func InternalServerError

func InternalServerError(err ...string) *ErrorResBody

InternalServerError

func MethodNotAllowed

func MethodNotAllowed(err ...string) *ErrorResBody

MethodNotAllowed

func NotFound

func NotFound(err ...string) *ErrorResBody

NotFound

func Options

func Options() *ErrorResBody

Option

func UnProcessableEntity

func UnProcessableEntity(err ...string) *ErrorResBody

UnProcessableEntity

func Unauthorized

func Unauthorized(err ...string) *ErrorResBody

Unauthorized

func (ErrorResBody) ToJson

func (er ErrorResBody) ToJson() string

To json

type GrantTypeConfig

type GrantTypeConfig int

Group table config struct

const (
	GrantPassword GrantTypeConfig = iota
	GrantRefreshToken
)

func (GrantTypeConfig) String

func (gc GrantTypeConfig) String() string

type GroupWithUserGroupWithPolicy

type GroupWithUserGroupWithPolicy struct {
	entity.Group
	entity.UserGroup
	entity.Policy
}

The table `groups` and `user_groups` and `policy` struct

type JwtPayload

type JwtPayload struct {
	UserUuid     string                 `json:"user_uuid"`
	Username     string                 `json:"user_name"`
	ServerId     string                 `json:"server_id"`
	Expires      string                 `json:"expires"`
	IssueDate    string                 `json:"issue_date"`
	UserPolicies []structure.UserPolicy `json:"user_policies"`
	IsRefresh    bool                   `json:"is_refresh"`
}

Payload in jwt

type PolicyRequest

type PolicyRequest struct {
	Name           string `validate:"required"json:"name"`
	ToUserEmail    string `validate:"required"json:"to_user_email"`
	RoleUuid       string `validate:"required"json:"role_uuid"`
	PermissionUuid string `validate:"required"json:"permission_uuid"`
}

Policy request struct

type PolicyResponse

type PolicyResponse struct {
	Name           string    `json:"policy_name"`
	RoleName       string    `json:"role_name"`
	RoleUuid       string    `json:"role_uuid"`
	PermissionName string    `json:"permission_name"`
	PermissionUuid uuid.UUID `json:"permission_uuid"`
	ServiceName    string    `json:"service_name"`
	ServiceUuid    uuid.UUID `json:"service_uuid"`
	GroupName      string    `json:"group_name"`
	GroupUuid      uuid.UUID `json:"group_uuid"`
}

The api policy response struct

func (PolicyResponse) Build

func (p PolicyResponse) Build() PolicyResponse

func (PolicyResponse) SetGroupName

func (p PolicyResponse) SetGroupName(groupName *string) PolicyResponseBuilder

func (PolicyResponse) SetName

func (p PolicyResponse) SetName(name *string) PolicyResponseBuilder

func (PolicyResponse) SetPermissionName

func (p PolicyResponse) SetPermissionName(permissionName *string) PolicyResponseBuilder

func (PolicyResponse) SetRoleName

func (p PolicyResponse) SetRoleName(roleName *string) PolicyResponseBuilder

func (PolicyResponse) SetServiceName

func (p PolicyResponse) SetServiceName(serviceName *string) PolicyResponseBuilder

type PolicyResponseBuilder

type PolicyResponseBuilder interface {
	// Set policy name at response data
	SetName(name *string) PolicyResponseBuilder

	// Set role_name at response data
	SetRoleName(roleName *string) PolicyResponseBuilder

	// Set permission_name at response data
	SetPermissionName(permissionName *string) PolicyResponseBuilder

	// Set service_name at response data
	SetServiceName(serviceName *string) PolicyResponseBuilder

	// Set group_name at response data
	SetGroupName(groupName *string) PolicyResponseBuilder

	// Build PolicyResponse struct
	Build() PolicyResponse
}

Builder interface

func NewPolicyResponse

func NewPolicyResponse() PolicyResponseBuilder

PolicyResponse constructor

type TokenRequest

type TokenRequest struct {
	Password     string `json:"password"`
	Email        string `json:"email"`
	GrantType    string `json:"grant_type"`
	RefreshToken string `json:"refresh_token"`
}

Token request

func (TokenRequest) IsRefresh

func (t TokenRequest) IsRefresh() bool

type TokenResponse

type TokenResponse struct {
	Token        string `json:"token"`
	RefreshToken string `json:"refresh_token"`
}

Token response

type UserPolicyOnGroupResponse

type UserPolicyOnGroupResponse struct {
	Username       string `json:"username"`
	Email          string `json:"email"`
	ServiceName    string `json:"service_name"`
	PolicyName     string `json:"policy_name"`
	RoleName       string `json:"role_name"`
	PermissionName string `json:"permission_name"`
}

The user policy response struct

type UserPolicyOnServiceResponse

type UserPolicyOnServiceResponse struct {
	Username       string `json:"username"`
	Email          string `json:"email"`
	PolicyName     string `json:"policy_name"`
	GroupName      string `json:"group_name"`
	GroupUuid      string `json:"group_uuid"`
	RoleName       string `json:"role_name"`
	RoleUuid       string `json:"role_uuid"`
	PermissionName string `json:"permission_name"`
	PermissionUuid string `json:"permission_uuid"`
}

The user policy response struct

type UserResponse

type UserResponse struct {
	Uuid     string `json:"uuid"`
	Username string `json:"username"`
	Email    string `json:"email"`
}

user struct

type UserWithOperatorPolicy

type UserWithOperatorPolicy struct {
	entity.User
	entity.OperatorPolicy
	entity.Role
}

The table `users` and `operator_policies` and `roles` struct

type UserWithUserServiceWithService

type UserWithUserServiceWithService struct {
	entity.User
	entity.UserService
	entity.Service
}

The table `users` and `user_services` and `services` struct

Jump to

Keyboard shortcuts

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