Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introduce names for user backends - via IUserBackend #12819

Merged
merged 1 commit into from Dec 19, 2014

Conversation

MorrisJobke
Copy link
Contributor

cc @DeepDiver1975 @icewind1991 @PVince81 @DeepDiver1975

Is this how we should add stuff to a interface that is implemented by third party apps?

ref #12620 #12806

@MorrisJobke MorrisJobke added this to the 8.0-current milestone Dec 12, 2014
@MorrisJobke
Copy link
Contributor Author

cc @blizzz

@LukasReschke LukasReschke mentioned this pull request Dec 12, 2014
23 tasks
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP;

interface IUserInterfaceV2 extends UserInterface {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay... UserInterface... I thought it was about the web UI but actually managing users.
Should probably be called IUserManagement or something else instead. Especially that the "I" is already there for "Interface"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-.- damn I was just blind for this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe IUserBackend? Because we have IUser(represents one user), IUserManger (manages user backends), UserInterface (old version of this but it describes a backend)

@MorrisJobke
Copy link
Contributor Author

@PVince81 I renamed the class ;)

@MorrisJobke MorrisJobke changed the title introduce names for user backends - via IUserInterfacev2 introduce names for user backends - via IUserBackend Dec 13, 2014
@PVince81
Copy link
Contributor

Will the JS UI call t() on the name to get it translated at display time ?

@PVince81
Copy link
Contributor

👍

I get you cannot / don't want to rename the "UserInterface" interface as it was there already, which is fine.

@MorrisJobke
Copy link
Contributor Author

Will the JS UI call t() on the name to get it translated at display time ?

Not yet. Should it be done in the JS part or in the PHP part also?

@PVince81
Copy link
Contributor

I suggest to do it in the JS part when rendering the results. This way your REST results are closer to the original data and the JS is taking care of presentation.

@LukasReschke
Copy link
Member

Not sure if that is not something that belongs into implementsAction and the user manager? - Though I have no idea what our goal here is ;-)

@MorrisJobke
Copy link
Contributor Author

Not sure if that is not something that belongs into implementsAction and the user manager? - Though I have no idea what our goal here is ;-)

@DeepDiver1975 @icewind1991 @PVince81 Opinions?

* Interface UserInterface
*
* @package OCP
* @deprecated Use \OCP\IUserBackend instead
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this been released already, or is it new in oC8, because then I'd just delete it right away

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is a bit older ;) It's already in stable5 ;) https://github.com/owncloud/core/blob/stable5/lib/public/userinterface.php

@nickvergessen
Copy link
Contributor

Not that strings are not going to be translated, because there is no $l->t() which would add it to transifex

@MorrisJobke
Copy link
Contributor Author

Not that strings are not going to be translated, because there is no $l->t() which would add it to transifex

? There are no translated strings in here. If so, then they are in a new PR that follows this one.

@nickvergessen
Copy link
Contributor

I just mean, adding something like t($userBackendName) in JS will not working, unless t('Database'), etc is added somewhere

@MorrisJobke
Copy link
Contributor Author

@nickvergessen That's another problem, that shouldn't be addressed by this PR

@DeepDiver1975
Copy link
Member

Not sure if that is not something that belongs into implementsAction and the user manager? - Though I have no idea what our goal here is ;-)

@DeepDiver1975 @icewind1991 @PVince81 Opinions?

I'd follow the approach to introduce an interface just like IApacheBackend - basically interface without extends

@MorrisJobke
Copy link
Contributor Author

@DeepDiver1975 Implemented and tested your approach. Ready for review

@@ -27,7 +27,7 @@

use OCA\user_ldap\lib\BackendUtility;

class USER_LDAP extends BackendUtility implements \OCP\UserInterface {
class USER_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserInterface {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is also necessary for user_proxy.php, i can take care of it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done with fed45af

@blizzz
Copy link
Contributor

blizzz commented Dec 18, 2014

@MorrisJobke
Copy link
Contributor Author

This wants to be adjusted as well: https://github.com/owncloud/core/blob/master/lib/private/user/manager.php#L282

Why? The additional name requires the new Interface. For other backends you need to add a fallback there. Why change this internal thing if it works already?

@blizzz
Copy link
Contributor

blizzz commented Dec 18, 2014

This wants to be adjusted as well: https://github.com/owncloud/core/blob/master/lib/private/user/manager.php#L282

Why? The additional name requires the new Interface. For other backends you need to add a fallback there. Why change this internal thing if it works already?

Well, in order to use the backend name, if available, instead of the class name. I.e. the backend would be needed to test if it is an instance of IUserBackend, too. Just as in like the method you used in User.

@MorrisJobke
Copy link
Contributor Author

@blizzz Fixed ;)

@@ -279,10 +279,15 @@ public function countUsers() {
if ($backend->implementsActions(\OC_User_Backend::COUNT_USERS)) {
$backendusers = $backend->countUsers();
if($backendusers !== false) {
if(isset($userCountStatistics[get_class($backend)])) {
$userCountStatistics[get_class($backend)] += $backendusers;
if($this->backend instanceof \OCP\IUserBackend) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

almost. $backend not $this-backend. we're looping through $this->backends.

@MorrisJobke
Copy link
Contributor Author

@blizzz done

@MorrisJobke
Copy link
Contributor Author

Jenkins PR: #12953

@MorrisJobke
Copy link
Contributor Author

@owncloud-bot retest this please

@MorrisJobke
Copy link
Contributor Author

I will have a look

00:14:14.353 
00:14:14.353 There were 2 failures:
00:14:14.353 
00:14:14.353 1) Test\User\Manager::testCountUsersOneBackend
00:14:14.353 Failed asserting that false is true.
00:14:14.353 
00:14:14.353 /var/jenkins/workspace/pull-request-analyser-ng-simple@3/label/SLAVE/tests/lib/user/manager.php:388
00:14:14.354 
00:14:14.354 2) Test\User\Manager::testCountUsersTwoBackends
00:14:14.354 Failed asserting that false is true.
00:14:14.354 
00:14:14.354 /var/jenkins/workspace/pull-request-analyser-ng-simple@3/label/SLAVE/tests/lib/user/manager.php:426

* LDAP with multiple servers also proved backendName
@MorrisJobke
Copy link
Contributor Author

Issue is fixed now :) Ready for review again.

@MorrisJobke
Copy link
Contributor Author

jenkins PR: #12956

@scrutinizer-notifier
Copy link

The inspection completed: 2 new issues, 6 updated code elements

@ghost
Copy link

ghost commented Dec 19, 2014

Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/5128/

Build result: FAILURE

[...truncated 17 lines...]using GIT_SSH to set credentials using .gitcredentials to set credentials > git config --local credential.helper store --file=/tmp/git1007877746804277364.credentials # timeout=10 > git fetch --tags --progress https://github.com/owncloud/core.git +refs/pull/:refs/remotes/origin/pr/ > git config --local --remove-section credential # timeout=10 > git rev-parse origin/pr/12819/merge^{commit} # timeout=10 > git branch -a --contains 02c9d42ee8e0e8b23fbaaf9fac29d10ac8c01aff # timeout=10 > git rev-parse remotes/origin/pr/12819/merge^{commit} # timeout=10Checking out Revision 02c9d42ee8e0e8b23fbaaf9fac29d10ac8c01aff (origin/pr/12819/merge) > git config core.sparsecheckout # timeout=10 > git checkout -f 02c9d42ee8e0e8b23fbaaf9fac29d10ac8c01aff > git rev-list c508f25f60e5db5bcc8fe0bd962a46b0376c05c2 # timeout=10First time build. Skipping changelog. > git remote # timeout=10 > git submodule init # timeout=10 > git submodule sync # timeout=10 > git config --get remote.origin.url # timeout=10 > git submodule update --init --recursiveTriggering pull-request-analyser-ng-simple » SLAVEpull-request-analyser-ng-simple » SLAVE completed with result FAILUREStarted calculate disk usage of buildFinished Calculation of disk usage of build in 0 secondsStarted calculate disk usage of workspaceFinished Calculation of disk usage of workspace in 1 minute 25 second
Test FAILed.

@blizzz
Copy link
Contributor

blizzz commented Dec 19, 2014

👍 as soons as Jenkins is OK, too.

@DeepDiver1975 DeepDiver1975 merged commit 6da33e1 into master Dec 19, 2014
@DeepDiver1975 DeepDiver1975 deleted the user-backend-names branch December 19, 2014 12:16
@lock lock bot locked as resolved and limited conversation to collaborators Aug 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants