class Tilia::DavAcl::Fs::Collection

This is an ACL-enabled collection.

Attributes

acl[RW]

A list of ACL rules.

@var array

owner[RW]

Owner uri, or null for no owner.

@var string|null

Public Class Methods

new(path, acl, owner = nil) click to toggle source

Constructor

@param string path on-disk path. @param array acl ACL rules. @param string|null owner principal owner string.

Calls superclass method Tilia::Dav::Fs::Node::new
# File lib/tilia/dav_acl/fs/collection.rb, line 27
def initialize(path, acl, owner = nil)
  super(path)
  @acl = acl
  @owner = owner
end

Public Instance Methods

acl=(_acl) click to toggle source

Updates the ACL

This method will receive a list of new ACE's as an array argument.

@param array acl @return void

# File lib/tilia/dav_acl/fs/collection.rb, line 88
def acl=(_acl)
  fail Dav::Exception::Forbidden, 'Setting ACL is not allowed here'
end
child(name) click to toggle source

Returns a specific child node, referenced by its name

This method must throw SabreDAVExceptionNotFound if the node does not exist.

@param string name @throws DAVExceptionNotFound @return DAVINode

# File lib/tilia/dav_acl/fs/collection.rb, line 41
def child(name)
  path = "#{@path}/#{name}"

  fail Dav::Exception::NotFound, 'File could not be located' unless ::File.exist?(path)
  fail Dav::Exception::Forbidden, 'Permission denied to . and ..' if name == '.' || name == '..'

  if ::File.directory?(path)
    return Collection.new(path, @acl.deep_dup, @owner)
  else
    return File.new(path, @acl.deep_dup, @owner)
  end
end
group() click to toggle source

Returns a group principal

This must be a url to a principal, or null if there's no owner

@return string|null

# File lib/tilia/dav_acl/fs/collection.rb, line 66
def group
  nil
end
supported_privilege_set() click to toggle source

Returns the list of supported privileges for this node.

The returned data structure is a list of nested privileges. See Tilia::DavAcl::Plugin::getDefaultSupportedPrivilegeSet for a simple standard structure.

If null is returned from this method, the default privilege set is used, which is fine for most common usecases.

@return array|null

# File lib/tilia/dav_acl/fs/collection.rb, line 102
def supported_privilege_set
  nil
end