88 lines
2.0 KiB
Go
88 lines
2.0 KiB
Go
package authhelper
|
|
|
|
import (
|
|
ero "simrs-vx/internal/domain/references/organization"
|
|
)
|
|
|
|
type AuthKey struct{}
|
|
|
|
type AuthInfo struct {
|
|
Uuid string
|
|
User_Id uint
|
|
User_Name string
|
|
User_ContractPosition_code string
|
|
Employee_Position_Code *string
|
|
Intern_Position_Code *string
|
|
User_DivisionPositions []DivisionPosition
|
|
// User_DivisionPositions []DivisionPosition
|
|
// User_Position_Code string
|
|
}
|
|
|
|
type DivisionPosition struct {
|
|
Division_Code string `json:"division_code"`
|
|
DivisionPosition_Code string `json:"divisionPosition_code"`
|
|
}
|
|
|
|
func (a AuthInfo) IsDoctor() bool {
|
|
if a.Employee_Position_Code == nil {
|
|
return false
|
|
}
|
|
return *a.Employee_Position_Code == string(ero.EPCDoc)
|
|
}
|
|
|
|
func (a AuthInfo) IsNurse() bool {
|
|
if a.Employee_Position_Code == nil {
|
|
return false
|
|
}
|
|
return *a.Employee_Position_Code == string(ero.EPCNur)
|
|
}
|
|
|
|
func (a AuthInfo) IsNutritionist() bool {
|
|
if a.Employee_Position_Code == nil {
|
|
return false
|
|
}
|
|
return *a.Employee_Position_Code == string(ero.EPCNut)
|
|
}
|
|
|
|
func (a AuthInfo) IsLaborant() bool {
|
|
if a.Employee_Position_Code == nil {
|
|
return false
|
|
}
|
|
return *a.Employee_Position_Code == string(ero.EPCLab)
|
|
}
|
|
|
|
func (a AuthInfo) IsPharmacist() bool {
|
|
if a.Employee_Position_Code == nil {
|
|
return false
|
|
}
|
|
return *a.Employee_Position_Code == string(ero.EPCPha)
|
|
}
|
|
|
|
func (a AuthInfo) IsPayment() bool {
|
|
if a.Employee_Position_Code == nil {
|
|
return false
|
|
}
|
|
return *a.Employee_Position_Code == string(ero.EPCPay)
|
|
}
|
|
|
|
func (a AuthInfo) IsManagement() bool {
|
|
if a.Employee_Position_Code == nil {
|
|
return false
|
|
}
|
|
return *a.Employee_Position_Code == string(ero.EPCMan)
|
|
}
|
|
|
|
func (a AuthInfo) IsSpecialistIntern() bool {
|
|
if a.Intern_Position_Code == nil {
|
|
return false
|
|
}
|
|
return *a.Intern_Position_Code == string(ero.IPCSpecialist)
|
|
}
|
|
|
|
func (a AuthInfo) IsNurseIntern() bool {
|
|
if a.Intern_Position_Code == nil {
|
|
return false
|
|
}
|
|
return *a.Intern_Position_Code == string(ero.IPCNurse)
|
|
}
|