acl.user(userName).withEverything(); hudson.allow(acl); } catch (ZFSException e) {
acl.user(userName).withEverything(); hudson.allow(acl); } catch (ZFSException e) {
acl.user(userName).withEverything(); hudson.allow(acl); } catch (ZFSException e) {
acl.user(userName).withEverything(); hudson.allow(acl); } catch (ZFSException e) {
/** * Grants the specified set of permissions to this dataset. * NOTE that the "zfs_perm_*" libzfs.so routines are not present at * all in OpenZFS, nor even in Sun Solaris 10u8 (last seen in 10u6). * Not sure about Sol10u7 since it was a rather intermediate release. * They may have been replaced with other logic, since zfs_allow_t and * related data types and comments are still present in the headers. */ public void allow(ACLBuilder acl) { String abi = library.getFeature("LIBZFS4J_ABI_zfs_perm_set"); if (abi.equals("pre-sol10u8")) { for (PermissionBuilder b : acl.builders) { if(LIBZFS.zfs_perm_set(handle,b.toNativeFormat(this))!=0) throw new ZFSException(library); } } else { LOGGER.log(Level.FINE, "NO-OP: libzfs4j::allow() was called while LIBZFS4J_ABI_zfs_perm_set=='"+abi+"' and this is currently not implemented"); } }
protected nvlist_t toNativeFormat(ZFSObject dataset) { StringBuilder buf = new StringBuilder(); for (ZFSPermission p : permissions) { if(buf.length()>0) buf.append(','); buf.append(p); } // if none is specified, assume it's on this dataset and its descendants. // this is consistent with zfs CLI. if(inheritanceBits==0) inheritanceBits = 3; PtrByReference<nvlist_t> r = new PtrByReference<nvlist_t>(); if(libzfs.LIBZFS.zfs_build_perms(dataset.handle, who(), buf.toString().toLowerCase(), whoType.code, inheritanceBits, r)!=0) throw new ZFSException(dataset.library); return r.getValue(nvlist_t.class); } }
protected nvlist_t toNativeFormat(ZFSObject dataset) { StringBuilder buf = new StringBuilder(); for (ZFSPermission p : permissions) { if(buf.length()>0) buf.append(','); buf.append(p); } // if none is specified, assume it's on this dataset and its descendants. // this is consistent with zfs CLI. if(inheritanceBits==0) inheritanceBits = 3; PtrByReference<nvlist_t> r = new PtrByReference<nvlist_t>(); if(libzfs.LIBZFS.zfs_build_perms(dataset.handle, who(), buf.toString().toLowerCase(), whoType.code, inheritanceBits, r)!=0) throw new ZFSException(dataset.library); return r.getValue(nvlist_t.class); } }
/** * Revokes the specified set of permissions to this dataset. * See also the detailed "NOTE" comment above. */ public void unallow(ACLBuilder acl) { String abi = library.getFeature("LIBZFS4J_ABI_zfs_perm_remove"); if (abi.equals("pre-sol10u8")) { for (PermissionBuilder b : acl.builders) { if(LIBZFS.zfs_perm_remove(handle,b.toNativeFormat(this))!=0) throw new ZFSException(library); } } else { LOGGER.log(Level.FINE, "NO-OP: libzfs4j::unallow() was called while LIBZFS4J_ABI_zfs_perm_remove=='"+abi+"' and this is currently not implemented"); } }
public PermissionBuilder withEverything() { return with(EnumSet.allOf(ZFSPermission.class)); }
public PermissionBuilder with(ZFSPermission... args) { return with(Arrays.asList(args)); }
public PermissionBuilder withEverything() { return with(EnumSet.allOf(ZFSPermission.class)); }
public PermissionBuilder with(ZFSPermission... args) { return with(Arrays.asList(args)); }
/** * For group */ public PermissionBuilder group(final String groupName) { return add(new PermissionBuilder(zfs_deleg_who_type_t.ZFS_DELEG_GROUP) { protected String who() { return groupName; } }); }
/** * For user */ public PermissionBuilder user(final String userName) { return add(new PermissionBuilder(zfs_deleg_who_type_t.ZFS_DELEG_USER) { protected String who() { return userName; } }); }
/** * Grants the specified set of permissions to this dataset. */ public void allow(ACLBuilder acl) { for (PermissionBuilder b : acl.builders) { if(LIBZFS.zfs_perm_set(handle,b.toNativeFormat(this))!=0) throw new ZFSException(library); } }
/** * For everyone. */ public PermissionBuilder everyone() { return add(new PermissionBuilder(zfs_deleg_who_type_t.ZFS_DELEG_EVERYONE)); }
/** * For user */ public PermissionBuilder user(final String userName) { return add(new PermissionBuilder(zfs_deleg_who_type_t.ZFS_DELEG_USER) { protected String who() { return userName; } }); }
/** * Revokes the specified set of permissions to this dataset. */ public void unallow(ACLBuilder acl) { for (PermissionBuilder b : acl.builders) { if(LIBZFS.zfs_perm_remove(handle,b.toNativeFormat(this))!=0) throw new ZFSException(library); } }
public void allow(String userName) { ACLBuilder acl = new ACLBuilder(); acl.user(userName).withEverything(); zfsFileSystem.allow(acl); }
/** * For group */ public PermissionBuilder group(final String groupName) { return add(new PermissionBuilder(zfs_deleg_who_type_t.ZFS_DELEG_GROUP) { protected String who() { return groupName; } }); }