3 # Système de gestion des adhésions de Nos oignons
4 # Copyright © 2013-2014 Nos oignons <contact@nos-oignons.net>
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU Affero General Public License as
8 # published by the Free Software Foundation, either version 3 of the
9 # License, or (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU Affero General Public License for more details.
16 # You should have received a copy of the GNU Affero General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
24 def list_members(list)
25 `sudo -u list list_members #{Shellwords.escape(list)}`.strip.split
28 def add_member(list, email)
29 add_members(list, [email])
32 def add_members(list, emails)
33 IO.popen(['sudo', '-u', 'list', 'add_members', '-r', '-', list], 'w') do |io|
34 emails.each do |email|
40 def remove_member(list, email)
41 remove_members(list, [email])
44 def remove_members(list, emails)
45 IO.popen(['sudo', '-u', 'list', 'remove_members', '-f', '-', list], 'w') do |io|
46 emails.each do |email|