Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
8c8a019b
Unverified
Commit
8c8a019b
authored
8 years ago
by
Bjoern Schiessle
Browse files
Options
Downloads
Patches
Plain Diff
show correct display name if we have the user in one of our address books
Signed-off-by:
Bjoern Schiessle
<
bjoern@schiessle.org
>
parent
60a3893c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/files_sharing/lib/Controller/ShareAPIController.php
+24
-4
24 additions, 4 deletions
apps/files_sharing/lib/Controller/ShareAPIController.php
with
24 additions
and
4 deletions
apps/files_sharing/lib/Controller/ShareAPIController.php
+
24
−
4
View file @
8c8a019b
...
@@ -23,7 +23,6 @@
...
@@ -23,7 +23,6 @@
*/
*/
namespace
OCA\Files_Sharing\Controller
;
namespace
OCA\Files_Sharing\Controller
;
use
OC\Share20\Exception\ProviderException
;
use
OCP\AppFramework\Http\DataResponse
;
use
OCP\AppFramework\Http\DataResponse
;
use
OCP\AppFramework\OCS\OCSBadRequestException
;
use
OCP\AppFramework\OCS\OCSBadRequestException
;
use
OCP\AppFramework\OCS\OCSException
;
use
OCP\AppFramework\OCS\OCSException
;
...
@@ -37,7 +36,6 @@ use OCP\IL10N;
...
@@ -37,7 +36,6 @@ use OCP\IL10N;
use
OCP\IUserManager
;
use
OCP\IUserManager
;
use
OCP\IRequest
;
use
OCP\IRequest
;
use
OCP\IURLGenerator
;
use
OCP\IURLGenerator
;
use
OCP\IUser
;
use
OCP\Files\IRootFolder
;
use
OCP\Files\IRootFolder
;
use
OCP\Lock\LockedException
;
use
OCP\Lock\LockedException
;
use
OCP\Share\IManager
;
use
OCP\Share\IManager
;
...
@@ -187,11 +185,11 @@ class ShareAPIController extends OCSController {
...
@@ -187,11 +185,11 @@ class ShareAPIController extends OCSController {
}
else
if
(
$share
->
getShareType
()
===
\OCP\Share
::
SHARE_TYPE_REMOTE
)
{
}
else
if
(
$share
->
getShareType
()
===
\OCP\Share
::
SHARE_TYPE_REMOTE
)
{
$result
[
'share_with'
]
=
$share
->
getSharedWith
();
$result
[
'share_with'
]
=
$share
->
getSharedWith
();
$result
[
'share_with_displayname'
]
=
$share
->
getSharedWith
();
$result
[
'share_with_displayname'
]
=
$this
->
getDisplayNameFromAddressBook
(
$share
->
getSharedWith
()
,
'CLOUD'
)
;
$result
[
'token'
]
=
$share
->
getToken
();
$result
[
'token'
]
=
$share
->
getToken
();
}
else
if
(
$share
->
getShareType
()
===
\OCP\Share
::
SHARE_TYPE_EMAIL
)
{
}
else
if
(
$share
->
getShareType
()
===
\OCP\Share
::
SHARE_TYPE_EMAIL
)
{
$result
[
'share_with'
]
=
$share
->
getSharedWith
();
$result
[
'share_with'
]
=
$share
->
getSharedWith
();
$result
[
'share_with_displayname'
]
=
$share
->
getSharedWith
();
$result
[
'share_with_displayname'
]
=
$this
->
getDisplayNameFromAddressBook
(
$share
->
getSharedWith
()
,
'EMAIL'
)
;
$result
[
'token'
]
=
$share
->
getToken
();
$result
[
'token'
]
=
$share
->
getToken
();
}
}
...
@@ -200,6 +198,28 @@ class ShareAPIController extends OCSController {
...
@@ -200,6 +198,28 @@ class ShareAPIController extends OCSController {
return
$result
;
return
$result
;
}
}
/**
* Check if one of the users address books knows the exact property, if
* yes we return the full name.
*
* @param string $query
* @param string $property
* @return string
*/
private
function
getDisplayNameFromAddressBook
(
$query
,
$property
)
{
// FIXME: If we inject the contacts manager it gets initialized bofore any address books are registered
$result
=
\OC
::
$server
->
getContactsManager
()
->
search
(
$query
,
[
$property
]);
foreach
(
$result
as
$r
)
{
foreach
(
$r
[
$property
]
as
$value
)
{
if
(
$value
===
$query
)
{
return
$r
[
'FN'
];
}
}
}
return
$query
;
}
/**
/**
* Get a specific share by id
* Get a specific share by id
*
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment