Settings groups to ocs
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
7ca526f8ac
commit
d53193fd8e
|
@ -26,20 +26,19 @@ OC.Settings = _.extend(OC.Settings, {
|
|||
if ($elements.length > 0) {
|
||||
// Let's load the data and THEN init our select
|
||||
$.ajax({
|
||||
url: OC.generateUrl('/settings/users/groups'),
|
||||
url: OC.linkToOCS('cloud/groups', 2) + 'details',
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
var results = [];
|
||||
|
||||
// add groups
|
||||
if (!options.excludeAdmins) {
|
||||
$.each(data.data.adminGroups, function(i, group) {
|
||||
results.push({id:group.id, displayname:group.name});
|
||||
});
|
||||
if (data.ocs.data.groups && data.ocs.data.groups.length > 0) {
|
||||
|
||||
data.ocs.data.groups.forEach(function(group) {
|
||||
if (!options.excludeAdmins || group.id !== 'admin') {
|
||||
results.push({ id: group.id, displayname: group.displayname });
|
||||
}
|
||||
$.each(data.data.groups, function(i, group) {
|
||||
results.push({id:group.id, displayname:group.name});
|
||||
});
|
||||
})
|
||||
|
||||
// note: settings are saved through a "change" event registered
|
||||
// on all input fields
|
||||
$elements.select2(_.extend({
|
||||
|
@ -80,6 +79,10 @@ OC.Settings = _.extend(OC.Settings, {
|
|||
return m;
|
||||
}
|
||||
}, extraOptions || {}));
|
||||
} else {
|
||||
OC.Notification.show(t('settings', 'Group list is empty'), { type: 'error' });
|
||||
console.log(data);
|
||||
}
|
||||
},
|
||||
error: function(data) {
|
||||
OC.Notification.show(t('settings', 'Unable to retrieve the group list'), { type: 'error' });
|
||||
|
|
Loading…
Reference in New Issue