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

Add REST route for managing groups and users #12618

Merged
merged 6 commits into from
Dec 8, 2014

Conversation

LukasReschke
Copy link
Member

First step of a somewhat testable user management. - I know, the JSON returns are in an ugly format but the JS expects it that way. So let's keep it that way until we have time to fix the JS in the future.

Todo (group):

  • Migrate get handler (index)
  • Migrate create handler (create)
  • Migrate destroy handler (destroy)
  • Add possibility to rename group (update) (requires more work - let's do this later)
  • Write unit tests
  • Fix for subadmins

Todo (user):

  • Migrate get handler (index)
  • Migrate create handler (create)
  • Migrate destroy handler (destroy)
  • Add possibility to manage users (update) (requires more work - let's do this later in single steps instead one large one…)
  • Write unit tests
  • Fix for subadmins

FIXME:

  • Fix JS code for deletion of groups

Requires #12619

@MorrisJobke

@LukasReschke LukasReschke added this to the 8.0-current milestone Dec 4, 2014
@LukasReschke LukasReschke changed the title Add REST route for creating groups Add REST route for managing groups Dec 4, 2014
@@ -71,6 +80,9 @@ public function __construct(array $urlParams=array()){
$container->registerService('L10N', function(SimpleContainer $c) {
return $c->query('ServerContainer')->getL10N('settings');
});
$container->registerService('GroupManager', function(SimpleContainer $c) {
Copy link
Member

Choose a reason for hiding this comment

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

I'd use IContainer - SimpleContainer is not in the public namespace

@LukasReschke LukasReschke mentioned this pull request Dec 4, 2014
23 tasks
@LukasReschke LukasReschke changed the title Add REST route for managing groups Add REST route for managing groups and users Dec 4, 2014
@LukasReschke LukasReschke changed the title Add REST route for managing groups and users [WIP] Add REST route for managing groups and users Dec 4, 2014
@LukasReschke LukasReschke force-pushed the initial-work-migrate-to-appframework branch from bb48151 to b15abd7 Compare December 4, 2014 18:04
@MorrisJobke
Copy link
Contributor

@LukasReschke Still WIP or ready for final review?

@LukasReschke LukasReschke force-pushed the initial-work-migrate-to-appframework branch from 8b84369 to acfaa24 Compare December 6, 2014 12:56
@LukasReschke
Copy link
Member Author

@MorrisJobke Still not perfect but IMHO ready to review.

@LukasReschke LukasReschke force-pushed the initial-work-migrate-to-appframework branch from acfaa24 to a202d01 Compare December 6, 2014 13:07
@LukasReschke LukasReschke changed the title [WIP] Add REST route for managing groups and users Add REST route for managing groups and users Dec 6, 2014
@LukasReschke
Copy link
Member Author

Don't be shocked by that enormous amount of changes… - Most of it are unit tests…

@LukasReschke LukasReschke force-pushed the initial-work-migrate-to-appframework branch from 3cc1afd to 628f917 Compare December 6, 2014 13:53
@LukasReschke
Copy link
Member Author

@DeepDiver1975 Care to review this as well?

@Raydiation Just FYI regarding some AppFramework usage in core. - If you want to review this as well: You're more than welcome :-) (Yes - I know that static OC_Subadmin class is annoying as hell but that's something for later ™️ )

$groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) {
\OC_Hook::emit('OC_Group', 'pre_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID()));
});
return $groupManager;
Copy link
Member Author

Choose a reason for hiding this comment

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

@icewind1991 Your feedback on that, please. THX!

@LukasReschke LukasReschke force-pushed the initial-work-migrate-to-appframework branch from 66cf32e to 830a3a6 Compare December 6, 2014 14:05
@@ -188,12 +188,12 @@ DeleteHandler.prototype.deleteEntry = function(keepNotification) {

var payload = {};
payload[dh.ajaxParamID] = dh.oidToDelete;
console.log(dh);
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this needs to be removed ;)

@MorrisJobke
Copy link
Contributor

test plan:

  • creating users (as admin/subadmin)
  • deleting users (as admin/subadmin)
  • change users attributes (as admin/subadmin)
  • create groups
  • change groups (as admin/subadmin of multiple groups)
  • change quota (as admin/subadmin)
  • change group admins
  • list users (as admin/subadmin)
  • list all/grouped users (as admin/subadmin)

bugs:

  • "everyone" listing is empty
  • "everyone" listing is empty for subadmins

@MorrisJobke
Copy link
Contributor

I'm fine with this except the mentioned bug above. Once this is fixed I will give my thumbs up

First step of a somewhat testable user management. - I know, the JSON returns are in an ugly format but the JS expects it that way. So let's keep it that way until we have time to fix the JS in the future.
@LukasReschke LukasReschke force-pushed the initial-work-migrate-to-appframework branch from 227bb58 to fe7d9a7 Compare December 8, 2014 11:11
@LukasReschke
Copy link
Member Author

@MorrisJobke Should be fixed now.

@@ -153,6 +153,24 @@ public function delete() {
$this->emitter->emit('\OC\User', 'preDelete', array($this));
}
$result = $this->backend->deleteUser($this->uid);
if ($result) {

// FIXME: Feels like an hack - suggestions?
Copy link
Contributor

Choose a reason for hiding this comment

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

In what way ?
Should the storage removal happen somewhere else maybe, through registering to a deleteUser hook ? Maybe something for another time ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd vote to have it done triggered by a hook, but this is not urgent. This goes beyond just deleting and sometimes it might (pure speculation) be useful to have the possibility to "reset" a user. But as long as we don't have the need for it, it is ok to leave it for now/OC 8 like this.

@PVince81
Copy link
Contributor

PVince81 commented Dec 8, 2014

Code looks good apart from the HTTP codes part.

@LukasReschke
Copy link
Member Author

I added proper HTTP status codes with 8b3e389. - Please double check if I choose the right ones ;-)

@PVince81
Copy link
Contributor

PVince81 commented Dec 8, 2014

  • BUG: Create user that already exists: no error shown in JS side. Maybe due to HTTP code change

@LukasReschke
Copy link
Member Author

That should be fixed with c239578, though I only changed the response format and JS where necessary and not on every controller. That's something for later.

@MorrisJobke
Copy link
Contributor

@LukasReschke Can you go to the jenkins branch and merge your changes in?

@LukasReschke
Copy link
Member Author

Let me try…

@LukasReschke
Copy link
Member Author

Done. - Let's wait…

@scrutinizer-notifier
Copy link

The inspection completed: 288 new issues, 41 updated code elements

@LukasReschke
Copy link
Member Author

From #12693 (comment)

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

@LukasReschke
Copy link
Member Author

@PVince81 Can I consider this as 👍? ;-)

@PVince81
Copy link
Contributor

PVince81 commented Dec 8, 2014

Yes, 👍

LukasReschke added a commit that referenced this pull request Dec 8, 2014
…amework

Add REST route for managing groups and users
@LukasReschke LukasReschke merged commit f219f5a into master Dec 8, 2014
@LukasReschke LukasReschke deleted the initial-work-migrate-to-appframework branch December 8, 2014 20:37
@MorrisJobke MorrisJobke mentioned this pull request Dec 22, 2014
27 tasks
@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.

6 participants