1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

B #5606: GOCA - ACL rule zone parameter

Signed-off-by: Pierre Lafievre <pierre.lafievre@iguanesolutions.com>
This commit is contained in:
treywelsh 2021-11-10 11:59:16 +01:00 committed by Ruben S. Montero
parent a6744fb8eb
commit 714fe8edec
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87

View File

@ -18,6 +18,7 @@ package goca
import (
"encoding/xml"
"fmt"
"github.com/OpenNebula/one/src/oca/go/src/goca/schemas/acl"
)
@ -51,8 +52,22 @@ func (ac *ACLsController) Info() (*acl.Pool, error) {
// * user: User component of the new rule. A string containing a hex number.
// * resource: Resource component of the new rule. A string containing a hex number.
// * rights: Rights component of the new rule. A string containing a hex number.
func (ac *ACLsController) CreateRule(user, resource, rights string) (int, error) {
response, err := ac.c.Client.Call("one.acl.addrule", user, resource, rights)
// * zone: Optional zone component of the new rule. A string containing a hex number.
func (ac *ACLsController) CreateRule(user, resource, rights string, zone ...string) (int, error) {
if len(zone) > 1 {
return -1, fmt.Errorf("CreateRule: %d extra parameters passed", len(zone)-1)
}
parameters := []interface{}{
"one.acl.addrule", user, resource, rights,
}
for _, z := range zone {
parameters = append(parameters, z)
}
response, err := ac.c.Client.Call(parameters...)
if err != nil {
return -1, err
}