Make it possible to exclude admin groups from groups select2
This commit is contained in:
parent
8fbb63d316
commit
79f6b7b7ff
|
@ -16,10 +16,13 @@ OC.Settings = _.extend(OC.Settings, {
|
|||
* for groups)
|
||||
*
|
||||
* @param $elements jQuery element (hidden input) to setup select2 on
|
||||
* @param [extraOptions] extra options hash to pass to select2
|
||||
* @param {Array} [extraOptions] extra options hash to pass to select2
|
||||
* @param {Array} [options] extra options
|
||||
* @param {Array} [options.excludeAdmins=false] flag whether to exclude admin groups
|
||||
*/
|
||||
setupGroupsSelect: function($elements, extraOptions) {
|
||||
setupGroupsSelect: function($elements, extraOptions, options) {
|
||||
var self = this;
|
||||
options = options || {};
|
||||
if ($elements.length > 0) {
|
||||
// note: settings are saved through a "change" event registered
|
||||
// on all input fields
|
||||
|
@ -48,9 +51,11 @@ OC.Settings = _.extend(OC.Settings, {
|
|||
var results = [];
|
||||
|
||||
// add groups
|
||||
if (!options.excludeAdmins) {
|
||||
$.each(data.data.adminGroups, function(i, group) {
|
||||
results.push({id:group.id, displayname:group.name});
|
||||
});
|
||||
}
|
||||
$.each(data.data.groups, function(i, group) {
|
||||
results.push({id:group.id, displayname:group.name});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue