Documentation ¶
Index ¶
- func WriteError(w http.ResponseWriter, error string, code int)
- type AddUser
- type ErrorResBody
- func BadRequest(err ...string) *ErrorResBody
- func Conflict(err ...string) *ErrorResBody
- func Forbidden(err ...string) *ErrorResBody
- func InternalServerError(err ...string) *ErrorResBody
- func MethodNotAllowed(err ...string) *ErrorResBody
- func NotFound(err ...string) *ErrorResBody
- func Options() *ErrorResBody
- func UnProcessableEntity(err ...string) *ErrorResBody
- func Unauthorized(err ...string) *ErrorResBody
- type GrantTypeConfig
- type GroupWithUserGroupWithPolicy
- type JwtPayload
- type PolicyRequest
- type PolicyResponse
- func (p PolicyResponse) Build() PolicyResponse
- func (p PolicyResponse) SetGroupName(groupName *string) PolicyResponseBuilder
- func (p PolicyResponse) SetName(name *string) PolicyResponseBuilder
- func (p PolicyResponse) SetPermissionName(permissionName *string) PolicyResponseBuilder
- func (p PolicyResponse) SetRoleName(roleName *string) PolicyResponseBuilder
- func (p PolicyResponse) SetServiceName(serviceName *string) PolicyResponseBuilder
- type PolicyResponseBuilder
- type TokenRequest
- type TokenResponse
- type UserPolicyOnGroupResponse
- type UserPolicyOnServiceResponse
- type UserResponse
- type UserWithOperatorPolicy
- type UserWithUserServiceWithService
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 InternalServerError ¶
func InternalServerError(err ...string) *ErrorResBody
InternalServerError
func UnProcessableEntity ¶
func UnProcessableEntity(err ...string) *ErrorResBody
UnProcessableEntity
type GrantTypeConfig ¶
type GrantTypeConfig int
Group table config struct
const ( GrantPassword GrantTypeConfig = iota GrantRefreshToken )
func (GrantTypeConfig) String ¶
func (gc GrantTypeConfig) String() string
type GroupWithUserGroupWithPolicy ¶
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
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 ¶
The table `users` and `operator_policies` and `roles` struct
type UserWithUserServiceWithService ¶
The table `users` and `user_services` and `services` struct
Click to show internal directories.
Click to hide internal directories.