Class: Tilia::DavAcl::Fs::Collection
- Inherits:
-
Tilia::Dav::FsExt::Directory
- Object
- Tilia::Dav::Fs::Node
- Tilia::Dav::FsExt::Directory
- Tilia::DavAcl::Fs::Collection
- Includes:
- IAcl
- Defined in:
- lib/tilia/dav_acl/fs/collection.rb
Overview
This is an ACL-enabled collection.
Instance Attribute Summary collapse
-
#acl ⇒ Object
Returns a list of ACE’s for this node.
-
#owner ⇒ Object
readonly
Returns the owner principal.
Instance Method Summary collapse
-
#child(name) ⇒ Object
Returns a specific child node, referenced by its name.
-
#group ⇒ Object
Returns a group principal.
-
#initialize(path, acl, owner = nil) ⇒ Collection
constructor
Constructor.
-
#supported_privilege_set ⇒ Object
Returns the list of supported privileges for this node.
Methods included from Tilia::Dav::INode
#delete, #last_modified, #name, #name=
Methods inherited from Tilia::Dav::FsExt::Directory
#child_exists, #children, #create_directory, #create_file, #delete, #move_into, #quota_info
Methods included from Tilia::Dav::IMoveTarget
Methods included from Tilia::Dav::ICollection
#child_exists, #children, #create_directory, #create_file
Methods included from Tilia::Dav::IQuota
Methods inherited from Tilia::Dav::Fs::Node
Constructor Details
#initialize(path, acl, owner = nil) ⇒ Collection
Constructor
27 28 29 30 31 |
# File 'lib/tilia/dav_acl/fs/collection.rb', line 27 def initialize(path, acl, owner = nil) super(path) @acl = acl @owner = owner end |
Instance Attribute Details
#acl ⇒ Object
Returns a list of ACE’s for this node.
Each ACE has the following properties:
* 'privilege', a string such as {DAV:}read or {DAV:}write. These are
currently the only supported privileges
* 'principal', a url to the principal who owns the node
* 'protected' (optional), indicating that this ACE is not allowed to
be updated.
13 14 15 |
# File 'lib/tilia/dav_acl/fs/collection.rb', line 13 def acl @acl end |
#owner ⇒ Object
Returns the owner principal
This must be a url to a principal, or null if there’s no owner
18 19 20 |
# File 'lib/tilia/dav_acl/fs/collection.rb', line 18 def owner @owner end |
Instance Method Details
#child(name) ⇒ Object
Returns a specific child node, referenced by its name
This method must throw SabreDAVExceptionNotFound if the node does not exist.
41 42 43 44 45 46 47 48 49 50 51 52 |
# 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 ⇒ Object
Returns a group principal
This must be a url to a principal, or null if there’s no owner
66 67 68 |
# File 'lib/tilia/dav_acl/fs/collection.rb', line 66 def group nil end |
#supported_privilege_set ⇒ Object
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.
102 103 104 |
# File 'lib/tilia/dav_acl/fs/collection.rb', line 102 def supported_privilege_set nil end |