95 lines
2.2 KiB
Go
95 lines
2.2 KiB
Go
package auth
|
|
|
|
import (
|
|
ero "simrs-vx/internal/domain/references/organization"
|
|
)
|
|
|
|
type AuthKey struct{}
|
|
|
|
// const AuthKey = struct{}{}
|
|
type AuthInfo struct {
|
|
Uuid string
|
|
User_Id uint
|
|
User_Name string
|
|
User_ContractPosition_code string
|
|
Employee_Position_Code *string
|
|
Employee_Id *int
|
|
Doctor_Id *int
|
|
Nurse_Id *int
|
|
Midwife_Id *int
|
|
Nutritionist_Id *int
|
|
Laborant_Id *int
|
|
Pharmachist_Id *int
|
|
Intern_Position_Code *string
|
|
Roles []string
|
|
// User_DivisionPositions []DivisionPosition
|
|
}
|
|
|
|
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)
|
|
}
|