Example #1
0
// AddPerm adds a new permission to a Permset.
func (pset *Permset) AddPerm(perm Perm) error {
	rv, _ := C.acl_add_perm(pset.p, C.acl_perm_t(perm))
	if rv < 0 {
		return fmt.Errorf("unable to add perm to permset")
	}
	return nil
}
Example #2
0
// DeletePerm removes a single permission from a Permset.
func (pset *Permset) DeletePerm(perm Perm) error {
	p := C.acl_perm_t(perm)
	rv, _ := C.acl_delete_perm(pset.p, p)
	if rv < 0 {
		return fmt.Errorf("unable to delete perm")
	}
	return nil
}
Example #3
0
func (pset *Permset) addPerm(perm Perm) error {
	acl_add_perm, err := getSymbolPointer(pset.a.lib.handle, "acl_add_perm")
	if err != nil {
		return err
	}

	rv, err := C.my_acl_add_perm(acl_add_perm, pset.p, C.acl_perm_t(perm))
	if rv < 0 {
		return errwrap.Wrap(errors.New("unable to add perm to permset"), err)
	}
	return nil
}