OC-AUTH with admin persona

This commit is contained in:
mr
2024-10-30 16:18:21 +01:00
parent d87883b57f
commit d33d2eb343
15 changed files with 52 additions and 52 deletions

View File

@@ -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)