Documentation ¶
Overview ¶
Package user is used to define the system's user structure with user.User and extracting user's details in a request's context using ExtractRequestUser.
Index ¶
Constants ¶
const ( // ContextUserKey is the context key used to get and set the user's data in the context. ContextUserKey = "User" // ParamUserID is the name of the user id param in URL. ParamUserID = "id" // ParamApproverID is the name of the approver id param in the URL. ParamApproverID = "approverID" // ParamRequestContent is the name of the partial user name param in URL. ParamRequestContent = "content" // ParamSearchType is the name of the flag that determines which search to execute. ParamSearchType = "searchBy" // ExternalUserSource is the value of the source field of user that indicated that the user is external ExternalUserSource = "external" // InternalUserSource is the value of the source field of user that indicated that the user is internal InternalUserSource = "internal" // ConfigBucketPostfix is the name of the environment variable containing the postfix for the bucket. ConfigBucketPostfix = "bucket_postfix" // TransactionUserLabel is the label of the custom transaction field : user. TransactionUserLabel = "user" // HeaderDestionation is the header used to get and set the external destination. HeaderDestionation = "destination" // ConfigTomcalDest is the name of the environment variable containing the tomcal dest name. ConfigTomcalDest = "tomcal_dest_value" // ConfigCtsDest is the name of the environment variable containing the cts dest name. ConfigCtsDest = "cts_dest_value" ConfigCTSSuffix = "cts_suffix" )
const ( // SearchByName is an enum key for searching by name SearchByName searchByEnum = "SearchByName" // FindByMail is an enum key for finding by mail FindByMail searchByEnum = "FindByMail" // FindByT is an enum key for finding by user T FindByT searchByEnum = "FindByT" )
Variables ¶
This section is empty.
Functions ¶
func IsExternalUser ¶
IsExternalUser gets a userID and returns true if user is from an external source. Otherwise, returns false. Currently just and all of the external users don't have a valid mongoID .
func SetApmUser ¶
SetApmUser adds a user to the current apm transaction.
Types ¶
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router is a structure that handles users requests.
func NewRouter ¶
func NewRouter( userConn *grpcPoolTypes.ConnPool, logger *logrus.Logger, ) *Router
NewRouter creates a new Router, and initializes clients of User Service
with the given connections. If logger is non-nil then it will
be set as-is, otherwise logger would default to logrus.New().
func (*Router) FindByMail ¶
FindByMail is the request handler for GET /users with flag FindByMailFlag
func (*Router) FindByUserT ¶
FindByUserT is the request handler for GET /users with flag FindByTFlag
func (*Router) GetUserByID ¶
GetUserByID is the request handler for GET /users/:id
func (*Router) SearchByName ¶
SearchByName is the request handler for GET /users
func (*Router) SearchByRouter ¶
SearchByRouter is the search by request router for GET /users
func (*Router) Setup ¶
func (r *Router) Setup(rg *gin.RouterGroup)
Setup sets up r and initializes its routes under rg.
type User ¶
type User struct { ID string `json:"id"` FirstName string `json:"firstname"` LastName string `json:"lastname"` Source string `json:"source"` Bucket string `json:"bucket"` DisplayName string `json:"displayName"` CurrentUnit string `json:"currentUnit"` Rank string `json:"rank"` Job string `json:"job"` }
User is a structure of an authenticated user.
func ExtractRequestUser ¶
ExtractRequestUser gets a context.Context and extracts the user's details from c.