Correctly get array of groups and send OCP\IGroup objects to enable method

This commit is contained in:
Joas Schilling 2015-03-24 12:56:42 +01:00
parent 9cb07f126d
commit b262c30fa9
2 changed files with 10 additions and 2 deletions

View file

@ -269,7 +269,15 @@ class OC_App {
$appManager = \OC::$server->getAppManager();
if (!is_null($groups)) {
$appManager->enableAppForGroups($app, $groups);
$groupManager = \OC::$server->getGroupManager();
$groupsList = [];
foreach ($groups as $group) {
$groupItem = $groupManager->get($group);
if ($groupItem instanceof \OCP\IGroup) {
$groupsList[] = $groupManager->get($group);
}
}
$appManager->enableAppForGroups($app, $groupsList);
} else {
$appManager->enableApp($app);
}

View file

@ -406,7 +406,7 @@ OC.Settings.Apps = OC.Settings.Apps || {
var element = $(this).parent().find('input.enable');
var groups = $(this).val();
if (groups && groups !== '') {
groups = groups.split(',');
groups = groups.split('|');
} else {
groups = [];
}