email 주소를 제대로 못읽는 문제 수정
This commit is contained in:
@ -123,7 +123,7 @@ func (caller apiCaller) getAccessableServices() ([]*serviceDescription, []string
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
email := v.(string)
|
||||
email = v.(string)
|
||||
_, admin = caller.admins[email]
|
||||
}
|
||||
|
||||
|
||||
@ -166,10 +166,10 @@ type maintenance struct {
|
||||
}
|
||||
|
||||
type division struct {
|
||||
Url string `bson:"url"`
|
||||
Priority int `bson:"priority"`
|
||||
State divisionStateName `bson:"state"`
|
||||
Maintenance *maintenance `bson:"maintenance"`
|
||||
Url string // 요것은 클라이언트 빌드하고 나서 json:"-"으로 변경하자. 클라이언트에 직접 내려보내지 않음
|
||||
Priority int
|
||||
State divisionStateName
|
||||
Maintenance *maintenance `bson:",omitempty" json:",omitempty"`
|
||||
}
|
||||
|
||||
type serviceDescription struct {
|
||||
@ -307,9 +307,10 @@ func (sh *serviceDescription) prepare(mg *Maingate) error {
|
||||
|
||||
if len(sh.ApiUsers) == 0 {
|
||||
sh.ApiUsers = map[string][]string{
|
||||
"service": {},
|
||||
"whitelist": {},
|
||||
"account": {},
|
||||
"service": {},
|
||||
"whitelist": {},
|
||||
"account": {},
|
||||
"maintenance": {},
|
||||
}
|
||||
}
|
||||
parsedUsers := make(map[string]map[string]bool)
|
||||
@ -329,7 +330,7 @@ func (sh *serviceDescription) prepare(mg *Maingate) error {
|
||||
bt, _ := json.Marshal(sh)
|
||||
atomic.StorePointer(&sh.serviceSerialized, unsafe.Pointer(&bt))
|
||||
|
||||
logger.Println("service is ready :", sh.ServiceName, sh.ServiceCode, sh.UseWhitelist, string(divmarshaled))
|
||||
logger.Println("service is ready :", sh.ServiceName, sh.ServiceCode, sh.UseWhitelist, sh.ApiUsers, string(divmarshaled))
|
||||
|
||||
return nil
|
||||
}
|
||||
@ -472,12 +473,17 @@ func (sh *serviceDescription) isValidAPIUser(category string, email string) bool
|
||||
return true
|
||||
}
|
||||
}
|
||||
} else if users, ok := catusers[category]; ok {
|
||||
logger.Println("isValidAPIUser failed. email is not allowed :", category, email, catusers)
|
||||
return false
|
||||
}
|
||||
|
||||
if users, ok := catusers[category]; ok {
|
||||
if _, ok := users[email]; ok {
|
||||
return true
|
||||
}
|
||||
|
||||
logger.Println("isValidAPIUser failed. email is not allowed :", category, email, users)
|
||||
return false
|
||||
}
|
||||
|
||||
logger.Println("isValidAPIUser failed. category is missing :", category)
|
||||
|
||||
@ -263,8 +263,6 @@ func (mg *Maingate) watchServiceCollection(parentctx context.Context, serveMux *
|
||||
case "update":
|
||||
data.Service.prepare(mg)
|
||||
if old := mg.services.get(data.Service.ServiceName); old != nil {
|
||||
logger.Printf("service is changed : %v", data.Service)
|
||||
|
||||
atomic.SwapPointer(&old.divisionsSerialized, data.Service.divisionsSerialized)
|
||||
atomic.SwapPointer(&old.apiUsers, data.Service.apiUsers)
|
||||
atomic.SwapPointer(&old.serviceSerialized, data.Service.serviceSerialized)
|
||||
|
||||
Reference in New Issue
Block a user