Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1476170f88 | |||
| d1898339b1 |
@@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"reflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CompanyPrivileges contains the privileges for a combination of email address and company id
|
// CompanyPrivileges contains the privileges for a combination of email address and company id
|
||||||
@@ -20,15 +21,17 @@ type CompanyPrivileges struct {
|
|||||||
|
|
||||||
// PrivilegeAdded is the event sent when a new privilege is added
|
// PrivilegeAdded is the event sent when a new privilege is added
|
||||||
type PrivilegeAdded struct {
|
type PrivilegeAdded struct {
|
||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
CompanyID string `json:"companyId"`
|
CompanyID string `json:"companyId"`
|
||||||
Admin bool `json:"admin"`
|
Name string `json:"name"`
|
||||||
Company bool `json:"company"`
|
RegistrationNumber string `json:"registrationNumber"`
|
||||||
Consumer bool `json:"consumer"`
|
Admin bool `json:"admin"`
|
||||||
Time bool `json:"time"`
|
Company bool `json:"company"`
|
||||||
Invoicing bool `json:"invoicing"`
|
Consumer bool `json:"consumer"`
|
||||||
Accounting bool `json:"accounting"`
|
Time bool `json:"time"`
|
||||||
Supplier bool `json:"supplier"`
|
Invoicing bool `json:"invoicing"`
|
||||||
|
Accounting bool `json:"accounting"`
|
||||||
|
Supplier bool `json:"supplier"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PrivilegeHandler processes PrivilegeAdded-events and fetches the initial set of privileges from an authz-service
|
// PrivilegeHandler processes PrivilegeAdded-events and fetches the initial set of privileges from an authz-service
|
||||||
@@ -85,6 +88,8 @@ func (h *PrivilegeHandler) Process(msg interface{}) bool {
|
|||||||
if ev, ok := msg.(*PrivilegeAdded); ok {
|
if ev, ok := msg.(*PrivilegeAdded); ok {
|
||||||
h.setPrivileges(ev)
|
h.setPrivileges(ev)
|
||||||
return true
|
return true
|
||||||
|
} else {
|
||||||
|
fmt.Printf("Got unexpected message type (%s): '%+v'\n", reflect.TypeOf(msg).String(), msg)
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user