Class: Droom::DavResource
- Inherits:
-
DAV4Rack::FileResource
- Object
- DAV4Rack::FileResource
- Droom::DavResource
- Defined in:
- lib/droom/dav_resource.rb
Instance Method Summary collapse
- #authenticate(email, password) ⇒ Object
- #person ⇒ Object
-
#prepare ⇒ Object
The DAV prefix is a way to evade the callback mechanism.
- #root ⇒ Object
Instance Method Details
#authenticate(email, password) ⇒ Object
30 31 32 33 |
# File 'lib/droom/dav_resource.rb', line 30 def authenticate(email, password) self.user = User.find_by_email(email) user.try(:valid_password?, password) end |
#person ⇒ Object
22 23 24 |
# File 'lib/droom/dav_resource.rb', line 22 def person user.person end |
#prepare ⇒ Object
The DAV prefix is a way to evade the callback mechanism. Prepare is only called by our fork of Dav4Rack, at the moment.
16 17 18 19 20 |
# File 'lib/droom/dav_resource.rb', line 16 def prepare raise Dav4Rack::Unauthorized unless person FileUtils.mkdir_p(root) unless File.exist?(root) person.create_personal_documents if path.blank? # any request for the root resource end |