# Need to import Mailman code sys.path.insert(0, self._mailman_dir) sitedir = os.path.join(sys.prefix, 'lib', 'python'+sys.version[:3], 'site-packages') sys.path.append(sitedir) from Mailman import mm_cfg from Mailman import MailList from Mailman import Utils from Mailman import Errors from Mailman import Message from Mailman import i18n from email.Utils import parseaddr class UserDesc: pass if not Utils.list_exists(self.listname): raise ScalakError("No such mailing list") mlist = MailList.MailList(self.listname) usr = UserDesc() usr.fullname, usr.address = parseaddr(email) usr.digest = 0 try: if mlist.isMember(email): mlist.ApprovedDeleteMember(email, 'bin/remove_members', 0, 0) mlist.Save() finally: mlist.Unlock() registerService(Mailman._type, Mailman._subtype, Mailman)
with open(os.path.join(self._svnPath, "{0}.conf".format(self._name)), "w") as confFile: confFile.write(config) def remove(self): super(Subversion, self).remove() # Deleting connected authz lines with open(os.path.join(self._dir, self._project.id, "repos/authz"), \ 'r') as file: buf = file.readlines() match = False res = [] for line in buf: if line.startswith("[{0}:".format(self.name)): match = True continue if line.startswith("["): match = False if not match: res.append(line) with open(os.path.join(self._dir, self._project.id, "repos/authz"), \ 'w') as file: file.writelines(res) registerService(Subversion._type, Subversion._subtype, Subversion)
def addUser(self, login, name = None, last_name = None, email = None, passwd = None, sha_passwd = None, note = None): env = Env(self._tracPath) @with_transaction(env) def add_user(db): c = db.cursor() c.execute("delete from session_attribute where sid=%s", (login,)) c.execute("delete from permission where username=%s", (login,)) c.execute("insert into session_attribute (sid, authenticated, \ name, value) values (%s, 1, 'email', %s)", (login, email)) c.execute("insert into session_attribute (sid, authenticated, \ name, value) values (%s, 1, 'name', %s)", (login, "{0} {1}".format(name, last_name))) c.execute("insert into permission values (%s, \"BROWSER_VIEW\")", \ (login,)) db.commit() c.close() def removeUser(self, id): env = Env(self._tracPath) @with_transaction(env) def remove_user(db): c = db.cursor() c.execute("delete from session_attribute where sid=%s", (id,)) c.execute("delete from permission where username=%s", (id,)) registerService(Trac._type, Trac._subtype, Trac)
"w") as confFile: confFile.write(config) def remove(self): super(Subversion, self).remove() # Deleting connected authz lines with open(os.path.join(self._dir, self._project.id, "repos/authz"), \ 'r') as file: buf = file.readlines() match = False res = [] for line in buf: if line.startswith("[{0}:".format(self.name)): match = True continue if line.startswith("["): match = False if not match: res.append(line) with open(os.path.join(self._dir, self._project.id, "repos/authz"), \ 'w') as file: file.writelines(res) registerService(Subversion._type, Subversion._subtype, Subversion)
env = Env(self._tracPath) @with_transaction(env) def add_user(db): c = db.cursor() c.execute("delete from session_attribute where sid=%s", (login, )) c.execute("delete from permission where username=%s", (login, )) c.execute( "insert into session_attribute (sid, authenticated, \ name, value) values (%s, 1, 'email', %s)", (login, email)) c.execute( "insert into session_attribute (sid, authenticated, \ name, value) values (%s, 1, 'name', %s)", (login, "{0} {1}".format(name, last_name))) c.execute("insert into permission values (%s, \"BROWSER_VIEW\")", \ (login,)) db.commit() c.close() def removeUser(self, id): env = Env(self._tracPath) @with_transaction(env) def remove_user(db): c = db.cursor() c.execute("delete from session_attribute where sid=%s", (id, )) c.execute("delete from permission where username=%s", (id, )) registerService(Trac._type, Trac._subtype, Trac)