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:
parent
a6744fb8eb
commit
714fe8edec
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user