Documentation
¶
Index ¶
- Variables
- type APIAuthResult
- type APIGroupCreateResult
- type APIResult
- type AuthClient
- func (c *AuthClient) DeleteGroup(req *DeleteGroupMemberRequest) error
- func (c *AuthClient) GroupCreate(req *GroupCreateRequest) error
- func (c *AuthClient) ModifyGroupMember(req *ModifyGroupMemberRequest) error
- func (c *AuthClient) ResourceCreate(req *ResourceAddition) error
- func (c *AuthClient) ResourceDelete(req *DelResourceRequest) error
- func (c *AuthClient) ResourceDetail(req *ListSpecificResourceRequest) (data *ResourceInfo, err error)
- func (c *AuthClient) ResourceList(req *ListResourceRequest) ([]ResListObj, error)
- func (c *AuthClient) ResourceUpdate(req *ResourceAddition) error
- func (c *AuthClient) ResourceVerify(req *PermRequest) error
- func (c *AuthClient) SetAuthToken(token string)
- func (c *AuthClient) SetContext(ctx context.Context)
- func (c *AuthClient) SetEndpoint(endpoint string)
- func (c *AuthClient) SetTimeout(timeout int)
- func (c *AuthClient) UserBasicInfo(userNames []string) (userBasicInfos []*UserBasicInfo, err error)
- type AuthResponse
- type BaseAuthDTO
- type DelResource
- type DelResourceRequest
- type DeleteGroupMemberRequest
- type GroupCreateRequest
- type GroupDetailReq
- type GroupMember
- type Groups
- type ListResourceRequest
- type ListSpecificResourceIds
- type ListSpecificResourceRequest
- type Members
- type ModifyGroupMemberRequest
- type PermRequest
- type PermResource
- type ResActions
- type ResListActions
- type ResListObj
- type ResourceAddition
- type ResourceAdditionModify
- type ResourceInfo
- type ResponseWithPagination
- type RestfulResult
- type Status
- type StatusResp
- type UserBasicInfo
- type UserCenterDetail
- type UserCenterDetailReq
- type UserDepartmentNRole
- type UserInfoResp
- type Users
Constants ¶
This section is empty.
Variables ¶
var (
UserAuthSvc = &middleware.UserAuthSvc{}
)
Functions ¶
This section is empty.
Types ¶
type APIAuthResult ¶
type APIAuthResult struct {
StatusInfo Status `json:"status"`
Data interface{} `json:"result"`
}
APIAuthResult api response
type APIGroupCreateResult ¶
type APIGroupCreateResult struct {
StatusInfo Status `json:"status"`
Data string `json:"data"`
Code int `json:"code"`
ErrType string `json:"err_type"`
ErrorType string `json:"error_type"`
}
APIGroupCreateResult api group create response
type APIResult ¶
type APIResult struct {
ErrUserMsg string `json:"err_user_msg"`
Code int `json:"code"`
ErrMsg string `json:"err_msg"`
}
APIResult .
type AuthClient ¶
type AuthClient struct {
// contains filtered or unexported fields
}
AuthClient auth client for req userauth-svc
func GetAuthClient ¶
func GetAuthClient(ctx context.Context, token string) *AuthClient
NewAuthClient init a auth client
func (*AuthClient) DeleteGroup ¶
func (c *AuthClient) DeleteGroup(req *DeleteGroupMemberRequest) error
DeleteGroup delete group
func (*AuthClient) GroupCreate ¶
func (c *AuthClient) GroupCreate(req *GroupCreateRequest) error
GroupCreate create a group
func (*AuthClient) ModifyGroupMember ¶
func (c *AuthClient) ModifyGroupMember(req *ModifyGroupMemberRequest) error
ModifyGroupMember modify group members
func (*AuthClient) ResourceCreate ¶
func (c *AuthClient) ResourceCreate(req *ResourceAddition) error
ResourceCreate creates resource and grants permissions to resource created. It returns http.StatusOK if created successfully, otherwise return error messages respectively.
func (*AuthClient) ResourceDelete ¶
func (c *AuthClient) ResourceDelete(req *DelResourceRequest) error
ResourceDelete deletes resource and permission associated with authorization user by path parameter id and request body DelRequest.
func (*AuthClient) ResourceDetail ¶
func (c *AuthClient) ResourceDetail(req *ListSpecificResourceRequest) (data *ResourceInfo, err error)
ResourceDetail lists the specific resource information according to path parameter id and query string uid and restype. It returns the detail resource information.
func (*AuthClient) ResourceList ¶
func (c *AuthClient) ResourceList(req *ListResourceRequest) ([]ResListObj, error)
ResourceList lists resource and permission associated with authorization user according to query parameter uid and restype. It returns resource list with filed resource id, level and actions operated on the resource.
func (*AuthClient) ResourceUpdate ¶
func (c *AuthClient) ResourceUpdate(req *ResourceAddition) error
ResourceUpdate .
func (*AuthClient) ResourceVerify ¶
func (c *AuthClient) ResourceVerify(req *PermRequest) error
ResourceVerify verifies that the user has permissions by request body PermRequest.
func (*AuthClient) SetAuthToken ¶
func (c *AuthClient) SetAuthToken(token string)
SetAuthToken set req auth token
func (*AuthClient) SetContext ¶
func (c *AuthClient) SetContext(ctx context.Context)
SetContext set req context
func (*AuthClient) SetEndpoint ¶
func (c *AuthClient) SetEndpoint(endpoint string)
SetEndpoint set req endpoint
func (*AuthClient) SetTimeout ¶
func (c *AuthClient) SetTimeout(timeout int)
SetTimeout set req timeout
func (*AuthClient) UserBasicInfo ¶
func (c *AuthClient) UserBasicInfo(userNames []string) (userBasicInfos []*UserBasicInfo, err error)
ResourceCreate creates resource and grants permissions to resource created. It returns http.StatusOK if created successfully, otherwise return error messages respectively.
type AuthResponse ¶
type AuthResponse struct {
ErrorType string `json:"error_type"`
Code int `json:"code"`
Result interface{} `json:"result,omitempty"`
}
AuthResponse .
type BaseAuthDTO ¶
BaseAuthDTO 基础用户信息
type DelResource ¶
type DelResource struct {
Type string `json:"type"`
ID string `json:"id"`
OwnerID int64 `json:"ownerid"`
}
DelResource .
type DelResourceRequest ¶
type DelResourceRequest struct {
UserID int64 `json:"uid"`
DelResource `json:"resource,omitempty"`
}
DelResourceRequest Delete resource req
type DeleteGroupMemberRequest ¶
type DeleteGroupMemberRequest struct {
GroupName []string `json:"group_name"`
}
DeleteGroupMemberRequest .
type GroupCreateRequest ¶
type GroupCreateRequest struct {
GroupName string `json:"group_name,omitempty"`
Department string `json:"department,omitempty"`
IpdProjectNumber string `json:"ipdproject_number,omitempty"`
GroupRole []string `json:"group_role,omitempty"`
Users []string `json:"users,omitempty"`
}
GroupCreateRequest .
type GroupDetailReq ¶
type GroupDetailReq struct {
UID int64 `json:"uid,omitempty"`
UName string `json:"uname,omitempty"`
GroupName string `json:"group_name"`
Current int `json:"current"`
PageSize int `json:"page_size"`
}
GroupDetailReq .
type GroupMember ¶
type GroupMember struct {
UID string `json:"uid"`
UName string `json:"uname"` // user name
Systemrole []string `json:"system_role"` // 用户系统角色
Operation string `json:"role"` // 用户组内角色
Department []string `json:"department"` // 用户属于的部门
Projects []string `json:"projects"`
Ctime string `json:"created_at"` // 用户创建时间
MeFlag bool `json:"me_flag"`
Buttons []string `json:"buttons"`
}
GroupMember .
type Groups ¶
type Groups struct {
Gname string `json:"gname,omitempty"`
Grole string `json:"grole,omitempty"`
Expiration string `json:"expiration,omitempty"`
}
Groups .
type ListResourceRequest ¶
type ListResourceRequest struct {
UID string `json:"uid"`
ResType string `json:"restype"`
IgnoreField string `form:"ignore_field"` // 忽略的字段,如性能问题只需要资源id,填写actions,visibility
}
ListResourceRequest List Resource req
type ListSpecificResourceIds ¶
type ListSpecificResourceIds struct {
UID int64 `json:"uid"`
ResID string `json:"res_ids"`
ResType string `json:"restype"`
}
ListSpecificResourceIds .
type ListSpecificResourceRequest ¶
type ListSpecificResourceRequest struct {
UID string `json:"uid"`
ResID string `json:"resid"`
ResType string `json:"restype"`
}
ListSpecificResourceRequest List the specific resource information
type Members ¶
type Members struct {
Users []*Users `json:"users,omitempty"`
Groups []*Groups `json:"groups,omitempty"`
Departments []string `json:"departments,omitempty"`
Organizations []string `json:"organizations,omitempty"`
}
Members .
type ModifyGroupMemberRequest ¶
type ModifyGroupMemberRequest struct {
GroupName string `json:"group_name"`
UserName string `json:"user_name"`
MemberRole string `json:"member_role"`
}
ModifyGroupMemberRequest .
type PermRequest ¶
type PermRequest struct {
UserID int64 `json:"uid"`
UserName string `json:"user_name"`
PermResource `json:"resource,omitempty"`
}
PermRequest .
type PermResource ¶
type PermResource struct {
ID string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
Action string `json:"action,omitempty"`
}
PermResource Permission verify req
type ResActions ¶
ResActions .
type ResListActions ¶
type ResListActions struct {
SysRole string `json:"sys_role,omitempty"`
Resources []ResListObj `json:"resources"`
}
ResListActions
type ResListObj ¶
type ResListObj struct {
ResID string `json:"id"`
Level string `json:"level"`
Deptid string `json:"deptid"`
Actions []string `json:"actions"`
Visibility []string `json:"visibility"`
}
ResListObj .
type ResourceAddition ¶
type ResourceAddition struct {
// swagger:ignore
UserID int64 `json:"uid"`
// swagger:ignore
ResID string `json:"resid"`
// swagger:ignore
Type string `json:"type"`
// resource level, private or public
// in: body
// required: true
Level string `json:"level" yaml:"level"`
// resource dept id, such as auto aiot or platform
// in: body
// required: true
DeptID string `json:"deptid" yaml:"dept_id"`
// authorized members
// in:body
// required: false
Members *Members `json:"members,omitempty"`
}
ResourceAddition .
type ResourceAdditionModify ¶
type ResourceAdditionModify struct {
UserID string `json:"uid"`
ResID string `json:"resid"`
Type string `json:"type" `
Level string `json:"level"`
DeptID string `json:"deptid"`
Members `json:"members,omitempty"`
}
ResourceAdditionModify create resource req
type ResourceInfo ¶
type ResourceInfo struct {
ID string `json:"id"`
Resid string `json:"resid"`
Restype string `json:"restype"`
Level string `json:"level"`
Deptid string `json:"deptid"`
Actions []string `json:"actions"`
IsViewAllDepartment bool `json:"is_view_all_department" form:"is_view_all_department"`
Members `json:"members"`
Visibility []string `json:"visibility"`
}
ResourceInfo .
type ResponseWithPagination ¶
type ResponseWithPagination struct {
ErrorType string `json:"error_type"`
Code int `json:"code"`
Result interface{} `json:"result,omitempty"`
}
ResponseWithPagination .
type RestfulResult ¶
type RestfulResult struct {
Code int `json:"code"`
TraceID string `json:"trace_id"`
Msg string `json:"msg"`
Data interface{} `json:"data"`
}
RestfulResult api restful response
type StatusResp ¶
StatusResp .
type UserBasicInfo ¶
type UserBasicInfo struct {
LdapGid int `json:"ldap_gid"`
LdapUid int `json:"ldap_uid"`
Mail string `json:"mail"`
OUID int `json:"ou_id"`
Status int `json:"status"`
UName string `json:"uname"`
UType int `json:"utype"` //类型1是普通用户
}
UserBasicInfo
type UserCenterDetail ¶
type UserCenterDetail struct {
UID string `json:"uid"`
UName string `json:"uname"`
Email string `json:"email"`
Departments []string `json:"departments"`
Detail []UserDepartmentNRole `json:"details"`
OU string `json:"organization"`
OUID int `json:"organization_id"`
}
UserCenterDetail .
type UserCenterDetailReq ¶
UserCenterDetailReq .
type UserDepartmentNRole ¶
UserDepartmentNRole .
type UserInfoResp ¶
type UserInfoResp struct {
Status StatusResp `json:"status"`
Result UserCenterDetail `json:"result"`
}
UserInfoResp .