ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilWebDAVLockObject.php
Go to the documentation of this file.
1 <?php
2 
11 {
24  {
25  $this->token = $token;
26  $this->obj_id = $obj_id;
27  $this->ilias_owner = $ilias_owner;
28  $this->dav_owner = $dav_owner;
29  $this->expires = $expires;
30  $this->depth = $depth;
31  $this->type = $type;
32  $this->scope = $scope;
33  }
34 
35  protected $token;
36  protected $obj_id;
37  protected $ilias_owner;
38  protected $dav_owner;
39  protected $expires;
40  protected $depth;
41  protected $type;
42  protected $scope;
43 
47  public function getToken()
48  {
49  return $this->token;
50  }
51 
55  public function getObjId()
56  {
57  return $this->obj_id;
58  }
59 
63  public function getIliasOwner()
64  {
65  return $this->ilias_owner;
66  }
67 
71  public function getDavOwner()
72  {
73  return $this->dav_owner;
74  }
75 
79  public function getExpires()
80  {
81  return $this->expires;
82  }
83 
87  public function getDepth()
88  {
89  return $this->depth;
90  }
91 
95  public function getType()
96  {
97  return $this->type;
98  }
99 
103  public function getScope()
104  {
105  return $this->scope;
106  }
107 
108  public static function createFromAssocArray($assoc_array)
109  {
110  return new ilWebDAVLockObject(
111  $assoc_array['token'],
112  $assoc_array['obj_id'],
113  $assoc_array['ilias_owner'],
114  $assoc_array['dav_owner'],
115  $assoc_array['expires'],
116  $assoc_array['depth'],
117  $assoc_array['type'],
118  $assoc_array['scope']
119  );
120  }
121 
130  public static function createFromSabreLock(Sabre\DAV\Locks\LockInfo $lock_info, $obj_id)
131  {
132  global $DIC;
133 
134  $ilias_lock = new ilWebDAVLockObject(
135  $lock_info->token, // token
136  $obj_id, // obj_id
137  $DIC->user()->getId(), // ilias_owner
138  $lock_info->owner, // dav_owner
139  time() + 360, // expires (hard coded like in the old webdav)
140  $lock_info->depth, // depth
141  'w', // type
142  $lock_info->scope
143  ); // scope
144 
145  return $ilias_lock;
146  }
147 
148  public function getAsSabreDavLock($uri)
149  {
150  global $DIC;
151 
152  $timestamp = time();
153 
154  $sabre_lock = new Sabre\DAV\Locks\LockInfo();
155  $sabre_lock->created;
156  $sabre_lock->depth = $this->depth;
157  $sabre_lock->owner = $this->dav_owner;
158  $sabre_lock->scope = $this->scope;
159  $sabre_lock->timeout = $this->expires - $timestamp;
160  $sabre_lock->created = $this->expires - 3600;
161  $sabre_lock->token = $this->token;
162  $sabre_lock->uri = $uri;
163 
164  return $sabre_lock;
165  }
166 }
Represents a lock on an ilias object.
__construct($token, $obj_id, $ilias_owner, $dav_owner, $expires, $depth, $type, $scope)
static createFromAssocArray($assoc_array)
global $DIC
Definition: goto.php:24
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:81
static createFromSabreLock(Sabre\DAV\Locks\LockInfo $lock_info, $obj_id)
Creates an ILIAS lock object from a sabreDAV lock object.