OC-AUTH with admin persona
This commit is contained in:
6
main.go
6
main.go
@@ -73,13 +73,11 @@ func generateSelfPeer() error {
|
||||
return err
|
||||
}
|
||||
// compare the public key from file with the one in the database
|
||||
fmt.Println(string(f), p.Data[0].(*peer.Peer).PublicKey)
|
||||
if !strings.Contains(string(f), p.Data[0].(*peer.Peer).PublicKey) {
|
||||
return errors.New("public key is different from the one in the database")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
fmt.Println("Creating new peer", strconv.Itoa(peer.SELF.EnumIndex()))
|
||||
// create a new peer
|
||||
o := oclib.GetConfLoader()
|
||||
peer := &peer.Peer{
|
||||
@@ -100,8 +98,10 @@ func generateSelfPeer() error {
|
||||
func discovery() {
|
||||
fmt.Println("Discovered")
|
||||
api := tools.API{}
|
||||
conn := infrastructure.GetPermissionConnector()
|
||||
conn.CreateRole("admin")
|
||||
conn.BindRole("admin", "admin")
|
||||
addPermissions := func(m map[string]interface{}) {
|
||||
conn := infrastructure.GetPermissionConnector()
|
||||
for k, v := range m {
|
||||
for _, p := range v.([]interface{}) {
|
||||
conn.CreatePermission(k, p.(string), true)
|
||||
|
||||
Reference in New Issue
Block a user