Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
a6c1b3ec
Commit
a6c1b3ec
authored
11 years ago
by
Robin Appelman
Browse files
Options
Downloads
Patches
Plain Diff
fix the config option to remove the ability for users to set their displayname
parent
f57c38df
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/private/server.php
+10
-2
10 additions, 2 deletions
lib/private/server.php
lib/private/user/manager.php
+13
-4
13 additions, 4 deletions
lib/private/user/manager.php
lib/private/user/user.php
+14
-3
14 additions, 3 deletions
lib/private/user/user.php
with
37 additions
and
9 deletions
lib/private/server.php
+
10
−
2
View file @
a6c1b3ec
...
@@ -69,10 +69,18 @@ class Server extends SimpleContainer implements IServerContainer {
...
@@ -69,10 +69,18 @@ class Server extends SimpleContainer implements IServerContainer {
return
new
Root
(
$manager
,
$view
,
$user
);
return
new
Root
(
$manager
,
$view
,
$user
);
});
});
$this
->
registerService
(
'UserManager'
,
function
(
$c
)
{
$this
->
registerService
(
'UserManager'
,
function
(
$c
)
{
return
new
\OC\User\Manager
();
/**
* @var SimpleContainer $c
* @var \OC\AllConfig $config
*/
$config
=
$c
->
query
(
'AllConfig'
);
return
new
\OC\User\Manager
(
$config
);
});
});
$this
->
registerService
(
'UserSession'
,
function
(
$c
)
{
$this
->
registerService
(
'UserSession'
,
function
(
$c
)
{
/** @var $c SimpleContainer */
/**
* @var SimpleContainer $c
* @var \OC\User\Manager $manager
*/
$manager
=
$c
->
query
(
'UserManager'
);
$manager
=
$c
->
query
(
'UserManager'
);
$userSession
=
new
\OC\User\Session
(
$manager
,
\OC
::
$session
);
$userSession
=
new
\OC\User\Session
(
$manager
,
\OC
::
$session
);
$userSession
->
listen
(
'\OC\User'
,
'preCreateUser'
,
function
(
$uid
,
$password
)
{
$userSession
->
listen
(
'\OC\User'
,
'preCreateUser'
,
function
(
$uid
,
$password
)
{
...
...
This diff is collapsed.
Click to expand it.
lib/private/user/manager.php
+
13
−
4
View file @
a6c1b3ec
...
@@ -35,7 +35,16 @@ class Manager extends PublicEmitter {
...
@@ -35,7 +35,16 @@ class Manager extends PublicEmitter {
*/
*/
private
$cachedUsers
=
array
();
private
$cachedUsers
=
array
();
public
function
__construct
()
{
/**
* @var \OC\AllConfig $config
*/
private
$config
;
/**
* @param \OC\AllConfig $config
*/
public
function
__construct
(
$config
=
null
)
{
$this
->
config
=
$config
;
$cachedUsers
=
$this
->
cachedUsers
;
$cachedUsers
=
$this
->
cachedUsers
;
$this
->
listen
(
'\OC\User'
,
'postDelete'
,
function
(
$user
)
use
(
&
$cachedUsers
)
{
$this
->
listen
(
'\OC\User'
,
'postDelete'
,
function
(
$user
)
use
(
&
$cachedUsers
)
{
$i
=
array_search
(
$user
,
$cachedUsers
);
$i
=
array_search
(
$user
,
$cachedUsers
);
...
@@ -103,7 +112,7 @@ class Manager extends PublicEmitter {
...
@@ -103,7 +112,7 @@ class Manager extends PublicEmitter {
if
(
isset
(
$this
->
cachedUsers
[
$uid
]))
{
if
(
isset
(
$this
->
cachedUsers
[
$uid
]))
{
return
$this
->
cachedUsers
[
$uid
];
return
$this
->
cachedUsers
[
$uid
];
}
}
$this
->
cachedUsers
[
$uid
]
=
new
User
(
$uid
,
$backend
,
$this
);
$this
->
cachedUsers
[
$uid
]
=
new
User
(
$uid
,
$backend
,
$this
,
$this
->
config
);
return
$this
->
cachedUsers
[
$uid
];
return
$this
->
cachedUsers
[
$uid
];
}
}
...
...
This diff is collapsed.
Click to expand it.
lib/private/user/user.php
+
14
−
3
View file @
a6c1b3ec
...
@@ -42,12 +42,18 @@ class User {
...
@@ -42,12 +42,18 @@ class User {
*/
*/
private
$home
;
private
$home
;
/**
* @var \OC\AllConfig $config
*/
private
$config
;
/**
/**
* @param string $uid
* @param string $uid
* @param \OC_User_Backend $backend
* @param \OC_User_Backend $backend
* @param Emitter $emitter
* @param \OC\Hooks\Emitter $emitter
* @param \OC\AllConfig $config
*/
*/
public
function
__construct
(
$uid
,
$backend
,
$emitter
=
null
)
{
public
function
__construct
(
$uid
,
$backend
,
$emitter
=
null
,
$config
=
null
)
{
$this
->
uid
=
$uid
;
$this
->
uid
=
$uid
;
if
(
$backend
and
$backend
->
implementsActions
(
OC_USER_BACKEND_GET_DISPLAYNAME
))
{
if
(
$backend
and
$backend
->
implementsActions
(
OC_USER_BACKEND_GET_DISPLAYNAME
))
{
$this
->
displayName
=
$backend
->
getDisplayName
(
$uid
);
$this
->
displayName
=
$backend
->
getDisplayName
(
$uid
);
...
@@ -58,6 +64,7 @@ class User {
...
@@ -58,6 +64,7 @@ class User {
$this
->
emitter
=
$emitter
;
$this
->
emitter
=
$emitter
;
$enabled
=
\OC_Preferences
::
getValue
(
$uid
,
'core'
,
'enabled'
,
'true'
);
//TODO: DI for OC_Preferences
$enabled
=
\OC_Preferences
::
getValue
(
$uid
,
'core'
,
'enabled'
,
'true'
);
//TODO: DI for OC_Preferences
$this
->
enabled
=
(
$enabled
===
'true'
);
$this
->
enabled
=
(
$enabled
===
'true'
);
$this
->
config
=
$config
;
}
}
/**
/**
...
@@ -175,8 +182,12 @@ class User {
...
@@ -175,8 +182,12 @@ class User {
* @return bool
* @return bool
*/
*/
public
function
canChangeDisplayName
()
{
public
function
canChangeDisplayName
()
{
if
(
$this
->
config
and
$this
->
config
->
getSystemValue
(
'allow_user_to_change_display_name'
)
===
false
)
{
return
false
;
}
else
{
return
$this
->
backend
->
implementsActions
(
\OC_USER_BACKEND_SET_DISPLAYNAME
);
return
$this
->
backend
->
implementsActions
(
\OC_USER_BACKEND_SET_DISPLAYNAME
);
}
}
}
/**
/**
* check if the user is enabled
* check if the user is enabled
...
...
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