Skip to content

Commit

Permalink
Merge pull request #399 from nextcloud/enhancement/principal-search-d…
Browse files Browse the repository at this point in the history
…isplay-name-or-email

Allow principal search for display name OR email
  • Loading branch information
ChristophWurst authored Feb 9, 2021
2 parents 9260de5 + 30bb24d commit 0e508a5
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/dist/*.js binary
/dist/*.js.map binary
2 changes: 1 addition & 1 deletion dist/dist.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/dist.js.map

Large diffs are not rendered by default.

25 changes: 23 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,19 @@ export default class DavClient {
], name);
}

/**
* performs a principal property search based on a principal's displayname OR email address
*
* @param {String} value
* @returns {Promise<Principal[]>}
*/
async principalPropertySearchByDisplaynameOrEmail(value) {
return this.principalPropertySearch([
{ name: [NS.DAV, 'displayname'] },
{ name: [NS.SABREDAV, 'email-address'] }
], value, 'anyof');
}

/**
* Performs a principal property based on the address of a room
*
Expand Down Expand Up @@ -274,11 +287,19 @@ export default class DavClient {
*
* @param {Array} props
* @param {String} match
* @param {String} test 'anyof', 'allof' or none
* @returns {Promise<Principal[]>}
*/
async principalPropertySearch(props, match) {
async principalPropertySearch(props, match, test) {
const [skeleton, propSearch] = XMLUtility.getRootSkeleton(
[NS.DAV, 'principal-property-search'], [NS.DAV, 'property-search']);
[NS.DAV, 'principal-property-search'],
[NS.DAV, 'property-search']
);
if (test) {
skeleton.attributes = [
['test', test]
];
}

propSearch.push({
name: [NS.DAV, 'prop'],
Expand Down

0 comments on commit 0e508a5

Please sign in to comment.