ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\DAVACL\Principal Class Reference

Principal class. More...

+ Inheritance diagram for Sabre\DAVACL\Principal:
+ Collaboration diagram for Sabre\DAVACL\Principal:

Public Member Functions

 __construct (PrincipalBackend\BackendInterface $principalBackend, array $principalProperties=[])
 Creates the principal object. More...
 
 getPrincipalUrl ()
 Returns the full principal url. More...
 
 getAlternateUriSet ()
 Returns a list of alternative urls for a principal. More...
 
 getGroupMemberSet ()
 Returns the list of group members. More...
 
 getGroupMembership ()
 Returns the list of groups this principal is member of. More...
 
 setGroupMemberSet (array $groupMembers)
 Sets a list of group members. More...
 
 getName ()
 Returns this principals name. More...
 
 getDisplayName ()
 Returns the name of the user. More...
 
 getProperties ($requestedProperties)
 Returns a list of properties. More...
 
 propPatch (DAV\PropPatch $propPatch)
 Updates properties on this node. More...
 
 getOwner ()
 Returns the owner principal. More...
 
- Public Member Functions inherited from Sabre\DAV\Node
 getLastModified ()
 Returns the last modification time as a unix timestamp. More...
 
 delete ()
 Deletes the current node. More...
 
 setName ($name)
 Renames the node. More...
 
 delete ()
 Deleted the current node. More...
 
 getName ()
 Returns the name of the node. More...
 
 setName ($name)
 Renames the node. More...
 
 getLastModified ()
 Returns the last modification time, as a unix timestamp. More...
 
 getAlternateUriSet ()
 Returns a list of alternative urls for a principal. More...
 
 getPrincipalUrl ()
 Returns the full principal url. More...
 
 getGroupMemberSet ()
 Returns the list of group members. More...
 
 getGroupMembership ()
 Returns the list of groups this principal is member of. More...
 
 setGroupMemberSet (array $principals)
 Sets a list of group members. More...
 
 getDisplayName ()
 Returns the displayname. More...
 
- Public Member Functions inherited from Sabre\DAV\IProperties
 propPatch (PropPatch $propPatch)
 Updates properties on this node. More...
 
 getProperties ($properties)
 Returns a list of properties for this nodes. More...
 
- Public Member Functions inherited from Sabre\DAVACL\IACL
 getOwner ()
 Returns the owner principal. More...
 
 getGroup ()
 Returns a group principal. More...
 
 getACL ()
 Returns a list of ACE's for this node. More...
 
 setACL (array $acl)
 Updates the ACL. More...
 
 getSupportedPrivilegeSet ()
 Returns the list of supported privileges for this node. More...
 

Protected Attributes

 $principalProperties
 
 $principalBackend
 

Detailed Description

Principal class.

This class is a representation of a simple principal

Many WebDAV specs require a user to show up in the directory structure.

This principal also has basic ACL settings, only allowing the principal access it's own principal.

Author
Evert Pot (http://evertpot.com/) @license http://sabre.io/license/ Modified BSD License

Definition at line 23 of file Principal.php.

Constructor & Destructor Documentation

◆ __construct()

Sabre\DAVACL\Principal::__construct ( PrincipalBackend\BackendInterface  $principalBackend,
array  $principalProperties = [] 
)

Creates the principal object.

Parameters
PrincipalBackend\BackendInterface$principalBackend
array$principalProperties

Definition at line 47 of file Principal.php.

47 {
48
49 if (!isset($principalProperties['uri'])) {
50 throw new DAV\Exception('The principal properties must at least contain the \'uri\' key');
51 }
52 $this->principalBackend = $principalBackend;
53 $this->principalProperties = $principalProperties;
54
55 }

References Sabre\DAVACL\Principal\$principalBackend, and Sabre\DAVACL\Principal\$principalProperties.

Member Function Documentation

◆ getAlternateUriSet()

Sabre\DAVACL\Principal::getAlternateUriSet ( )

Returns a list of alternative urls for a principal.

This can for example be an email address, or ldap url.

Returns
array

Implements Sabre\DAVACL\IPrincipal.

Definition at line 75 of file Principal.php.

75 {
76
77 $uris = [];
78 if (isset($this->principalProperties['{DAV:}alternate-URI-set'])) {
79
80 $uris = $this->principalProperties['{DAV:}alternate-URI-set'];
81
82 }
83
84 if (isset($this->principalProperties['{http://sabredav.org/ns}email-address'])) {
85 $uris[] = 'mailto:' . $this->principalProperties['{http://sabredav.org/ns}email-address'];
86 }
87
88 return array_unique($uris);
89
90 }

◆ getDisplayName()

Sabre\DAVACL\Principal::getDisplayName ( )

Returns the name of the user.

Returns
string

Implements Sabre\DAVACL\IPrincipal.

Definition at line 155 of file Principal.php.

155 {
156
157 if (isset($this->principalProperties['{DAV:}displayname'])) {
158 return $this->principalProperties['{DAV:}displayname'];
159 } else {
160 return $this->getName();
161 }
162
163 }
getName()
Returns this principals name.
Definition: Principal.php:142

References Sabre\DAVACL\Principal\getName().

+ Here is the call graph for this function:

◆ getGroupMemberSet()

Sabre\DAVACL\Principal::getGroupMemberSet ( )

Returns the list of group members.

If this principal is a group, this function should return all member principal uri's for the group.

Returns
array

Implements Sabre\DAVACL\IPrincipal.

Definition at line 100 of file Principal.php.

100 {
101
102 return $this->principalBackend->getGroupMemberSet($this->principalProperties['uri']);
103
104 }

◆ getGroupMembership()

Sabre\DAVACL\Principal::getGroupMembership ( )

Returns the list of groups this principal is member of.

If this principal is a member of a (list of) groups, this function should return a list of principal uri's for it's members.

Returns
array

Implements Sabre\DAVACL\IPrincipal.

Definition at line 114 of file Principal.php.

114 {
115
116 return $this->principalBackend->getGroupMemberShip($this->principalProperties['uri']);
117
118 }

◆ getName()

Sabre\DAVACL\Principal::getName ( )

Returns this principals name.

Returns
string

Implements Sabre\DAV\INode.

Definition at line 142 of file Principal.php.

142 {
143
144 $uri = $this->principalProperties['uri'];
145 list(, $name) = URLUtil::splitPath($uri);
146 return $name;
147
148 }
static splitPath($path)
Returns the 'dirname' and 'basename' for a path.
Definition: URLUtil.php:83

References $name, and Sabre\HTTP\URLUtil\splitPath().

Referenced by Sabre\DAVACL\Principal\getDisplayName().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOwner()

Sabre\DAVACL\Principal::getOwner ( )

Returns the owner principal.

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

Returns
string|null

Implements Sabre\DAVACL\IACL.

Definition at line 214 of file Principal.php.

214 {
215
216 return $this->principalProperties['uri'];
217
218
219 }

◆ getPrincipalUrl()

Sabre\DAVACL\Principal::getPrincipalUrl ( )

Returns the full principal url.

Returns
string

Implements Sabre\DAVACL\IPrincipal.

Definition at line 62 of file Principal.php.

62 {
63
64 return $this->principalProperties['uri'];
65
66 }

◆ getProperties()

Sabre\DAVACL\Principal::getProperties (   $requestedProperties)

Returns a list of properties.

Parameters
array$requestedProperties
Returns
array

Implements Sabre\DAV\IProperties.

Definition at line 171 of file Principal.php.

171 {
172
173 $newProperties = [];
174 foreach ($requestedProperties as $propName) {
175
176 if (isset($this->principalProperties[$propName])) {
177 $newProperties[$propName] = $this->principalProperties[$propName];
178 }
179
180 }
181
182 return $newProperties;
183
184 }

◆ propPatch()

Sabre\DAVACL\Principal::propPatch ( DAV\PropPatch  $propPatch)

Updates properties on this node.

This method received a PropPatch object, which contains all the information about the update.

To update specific properties, call the 'handle' method on this object. Read the PropPatch documentation for more information.

Parameters
DAV\PropPatch$propPatch
Returns
void

Definition at line 198 of file Principal.php.

198 {
199
200 return $this->principalBackend->updatePrincipal(
201 $this->principalProperties['uri'],
202 $propPatch
203 );
204
205 }

◆ setGroupMemberSet()

Sabre\DAVACL\Principal::setGroupMemberSet ( array  $groupMembers)

Sets a list of group members.

If this principal is a group, this method sets all the group members. The list of members is always overwritten, never appended to.

This method should throw an exception if the members could not be set.

Parameters
array$groupMembers
Returns
void

Implements Sabre\DAVACL\IPrincipal.

Definition at line 131 of file Principal.php.

131 {
132
133 $this->principalBackend->setGroupMemberSet($this->principalProperties['uri'], $groupMembers);
134
135 }

Field Documentation

◆ $principalBackend

Sabre\DAVACL\Principal::$principalBackend
protected

Definition at line 39 of file Principal.php.

Referenced by Sabre\DAVACL\Principal\__construct().

◆ $principalProperties

Sabre\DAVACL\Principal::$principalProperties
protected

Definition at line 32 of file Principal.php.

Referenced by Sabre\DAVACL\Principal\__construct().


The documentation for this class was generated from the following file: