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
28ceab2f
Commit
28ceab2f
authored
9 years ago
by
Thomas Müller
Browse files
Options
Downloads
Patches
Plain Diff
Fix endless recursion
parent
f558ac7d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
apps/dav/lib/carddav/converter.php
+15
-3
15 additions, 3 deletions
apps/dav/lib/carddav/converter.php
lib/private/user/user.php
+9
-7
9 additions, 7 deletions
lib/private/user/user.php
tests/lib/user/user.php
+1
-1
1 addition, 1 deletion
tests/lib/user/user.php
with
25 additions
and
11 deletions
apps/dav/lib/carddav/converter.php
+
15
−
3
View file @
28ceab2f
...
@@ -28,9 +28,10 @@ use Sabre\VObject\Property\Text;
...
@@ -28,9 +28,10 @@ use Sabre\VObject\Property\Text;
class
Converter
{
class
Converter
{
public
function
__construct
()
{
/**
}
* @param IUser $user
* @return VCard
*/
public
function
createCardFromUser
(
IUser
$user
)
{
public
function
createCardFromUser
(
IUser
$user
)
{
$uid
=
$user
->
getUID
();
$uid
=
$user
->
getUID
();
...
@@ -60,6 +61,11 @@ class Converter {
...
@@ -60,6 +61,11 @@ class Converter {
return
$vCard
;
return
$vCard
;
}
}
/**
* @param VCard $vCard
* @param IUser $user
* @return bool
*/
public
function
updateCard
(
VCard
$vCard
,
IUser
$user
)
{
public
function
updateCard
(
VCard
$vCard
,
IUser
$user
)
{
$uid
=
$user
->
getUID
();
$uid
=
$user
->
getUID
();
$displayName
=
$user
->
getDisplayName
();
$displayName
=
$user
->
getDisplayName
();
...
@@ -105,6 +111,12 @@ class Converter {
...
@@ -105,6 +111,12 @@ class Converter {
return
$updated
;
return
$updated
;
}
}
/**
* @param VCard $vCard
* @param string $name
* @param string|IImage $newValue
* @return bool
*/
private
function
propertyNeedsUpdate
(
VCard
$vCard
,
$name
,
$newValue
)
{
private
function
propertyNeedsUpdate
(
VCard
$vCard
,
$name
,
$newValue
)
{
if
(
is_null
(
$newValue
))
{
if
(
is_null
(
$newValue
))
{
return
false
;
return
false
;
...
...
This diff is collapsed.
Click to expand it.
lib/private/user/user.php
+
9
−
7
View file @
28ceab2f
...
@@ -71,14 +71,14 @@ class User implements IUser {
...
@@ -71,14 +71,14 @@ class User implements IUser {
* @param string $uid
* @param string $uid
* @param \OC_User_Interface $backend
* @param \OC_User_Interface $backend
* @param \OC\Hooks\Emitter $emitter
* @param \OC\Hooks\Emitter $emitter
* @param \OCP\IConfig $config
* @param IConfig|null $config
* @param IURLGenerator $urlGenerator
*/
*/
public
function
__construct
(
$uid
,
$backend
,
$emitter
=
null
,
IConfig
$config
=
null
,
$avatarManager
=
null
,
$urlGenerator
=
null
)
{
public
function
__construct
(
$uid
,
$backend
,
$emitter
=
null
,
IConfig
$config
=
null
,
$urlGenerator
=
null
)
{
$this
->
uid
=
$uid
;
$this
->
uid
=
$uid
;
$this
->
backend
=
$backend
;
$this
->
backend
=
$backend
;
$this
->
emitter
=
$emitter
;
$this
->
emitter
=
$emitter
;
$this
->
config
=
$config
;
$this
->
config
=
$config
;
$this
->
avatarManager
=
$avatarManager
;
$this
->
urlGenerator
=
$urlGenerator
;
$this
->
urlGenerator
=
$urlGenerator
;
if
(
$this
->
config
)
{
if
(
$this
->
config
)
{
$enabled
=
$this
->
config
->
getUserValue
(
$uid
,
'core'
,
'enabled'
,
'true'
);
$enabled
=
$this
->
config
->
getUserValue
(
$uid
,
'core'
,
'enabled'
,
'true'
);
...
@@ -88,9 +88,6 @@ class User implements IUser {
...
@@ -88,9 +88,6 @@ class User implements IUser {
$this
->
enabled
=
true
;
$this
->
enabled
=
true
;
$this
->
lastLogin
=
\OC
::
$server
->
getConfig
()
->
getUserValue
(
$uid
,
'login'
,
'lastLogin'
,
0
);
$this
->
lastLogin
=
\OC
::
$server
->
getConfig
()
->
getUserValue
(
$uid
,
'login'
,
'lastLogin'
,
0
);
}
}
if
(
is_null
(
$this
->
avatarManager
))
{
$this
->
avatarManager
=
\OC
::
$server
->
getAvatarManager
();
}
if
(
is_null
(
$this
->
urlGenerator
))
{
if
(
is_null
(
$this
->
urlGenerator
))
{
$this
->
urlGenerator
=
\OC
::
$server
->
getURLGenerator
();
$this
->
urlGenerator
=
\OC
::
$server
->
getURLGenerator
();
}
}
...
@@ -106,7 +103,7 @@ class User implements IUser {
...
@@ -106,7 +103,7 @@ class User implements IUser {
}
}
/**
/**
* get the displayname for the user, if no specific displayname is set it will fallback to the user id
* get the display
name for the user, if no specific display
name is set it will fallback to the user id
*
*
* @return string
* @return string
*/
*/
...
@@ -326,6 +323,11 @@ class User implements IUser {
...
@@ -326,6 +323,11 @@ class User implements IUser {
* @since 9.0.0
* @since 9.0.0
*/
*/
public
function
getAvatarImage
(
$size
)
{
public
function
getAvatarImage
(
$size
)
{
// delay the initialization
if
(
is_null
(
$this
->
avatarManager
))
{
$this
->
avatarManager
=
\OC
::
$server
->
getAvatarManager
();
}
$avatar
=
$this
->
avatarManager
->
getAvatar
(
$this
->
uid
);
$avatar
=
$this
->
avatarManager
->
getAvatar
(
$this
->
uid
);
$image
=
$avatar
->
get
(
-
1
);
$image
=
$avatar
->
get
(
-
1
);
if
(
$image
)
{
if
(
$image
)
{
...
...
This diff is collapsed.
Click to expand it.
tests/lib/user/user.php
+
1
−
1
View file @
28ceab2f
...
@@ -475,7 +475,7 @@ class User extends \Test\TestCase {
...
@@ -475,7 +475,7 @@ class User extends \Test\TestCase {
->
method
(
'getAbsoluteURL'
)
->
method
(
'getAbsoluteURL'
)
->
withAnyParameters
()
->
withAnyParameters
()
->
willReturn
(
'http://localhost:8888/owncloud'
);
->
willReturn
(
'http://localhost:8888/owncloud'
);
$user
=
new
\OC\User\User
(
'foo'
,
$backend
,
null
,
null
,
null
,
$urlGenerator
);
$user
=
new
\OC\User\User
(
'foo'
,
$backend
,
null
,
null
,
$urlGenerator
);
$this
->
assertEquals
(
"foo@localhost:8888/owncloud"
,
$user
->
getCloudId
());
$this
->
assertEquals
(
"foo@localhost:8888/owncloud"
,
$user
->
getCloudId
());
}
}
}
}
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