def run(self, args, conn): u = user.find_by_prefix_for_user(args[0], conn) if u: if not admin.checker.check_user_operation(conn.user, u): conn.write("You need a higher adminlevel to change the email address of %s.\n" % u.name) return if u.is_guest: conn.write(A_('You can only set the email for registered players.\n')) return email = args[1] if email is None: # TODO? assert(False) else: if '@' not in email: conn.write(A_('That does not look like an email address.\n')) return old_email = u.email u.set_email(email) db.add_comment(conn.user.id, u.id, 'Changed email address from "%s" to "%s".' % ( old_email, email)) if u.is_online: u.write_('%(aname)s has changed your email address to "%(email)s".\n', {'aname': conn.user.name, 'email': email}) conn.write(A_('Email address of %(uname)s changed to "%(email)s".\n') % {'uname': u.name, 'email': email})
def run(self, args, conn): u = user.find_by_prefix_for_user(args[0], conn) if u: if u.is_guest: conn.write(A_('Unregistered players cannot have comments.\n')) else: db.add_comment(conn.user.id, u.id, args[1]) conn.write(A_('Comment added for %s.\n') % u.name)
def sub(self, item, conn): self._require_admin(conn.user) u = user.find_by_prefix_for_user(item, conn) if u: if not u.is_muted: raise ListError(_('%s is not on the mute list.\n') % u.name) u.set_muted(False) if not u.is_guest: db.add_comment(conn.user.id, u.id, 'Unmuted.') self._notify_removed(conn, u)
def sub(self, item, conn): self._require_admin(conn.user) u = user.find_by_prefix_for_user(item, conn) if u: if not u.is_playbanned: raise ListError(_('%s is not on the playban list.\n') % u.name) u.set_playbanned(False) if not u.is_guest: db.add_comment(conn.user.id, u.id, 'Removed from the playbanned list.') self._notify_removed(conn, u)
def sub(self, item, conn): self._require_admin(conn.user) u = user.find_by_prefix_for_user(item, conn) if u: if u.is_guest: raise ListError(A_('Only registered players can be banned.\n')) if not u.is_banned: raise ListError(_('%s is not on the ban list.\n') % u.name) u.set_banned(False) db.add_comment(conn.user.id, u.id, 'Unbanned.') self._notify_removed(conn, u)
def sub(self, item, conn): self._require_admin(conn.user) u = user.find_by_prefix_for_user(item, conn) if u: if u.is_guest: raise ListError(A_('Only registered players can be ratedbanned.\n')) if not u.is_ratedbanned: raise ListError(_('%s is not on the ratedban list.\n') % u.name) u.set_ratedbanned(False) db.add_comment(conn.user.id, u.id, 'Removed from the ratedbanned list.') self._notify_removed(conn, u)
def add(self, item, conn): self._require_admin(conn.user) u = user.find_by_prefix_for_user(item, conn) if u: if u.is_admin(): raise ListError(A_('Admins cannot be playbanned.\n')) if u.is_playbanned: raise ListError(_('%s is already on the playban list.\n') % u.name) u.set_playbanned(True) if not u.is_guest: db.add_comment(conn.user.id, u.id, 'Playbanned.') self._notify_added(conn, u)
def add(self, item, conn): self._require_admin(conn.user) u = user.find_by_prefix_for_user(item, conn) if u: if u.is_admin(): raise ListError(A_('Admins cannot be playbanned.\n')) if u.is_playbanned: raise ListError( _('%s is already on the playban list.\n') % u.name) u.set_playbanned(True) if not u.is_guest: db.add_comment(conn.user.id, u.id, 'Playbanned.') self._notify_added(conn, u)
def add(self, item, conn): self._require_admin(conn.user) u = user.find_by_prefix_for_user(item, conn) if u: if u.is_guest: raise ListError(A_('Only registered players can be ratedbanned.\n')) if u.is_admin(): raise ListError(A_('Admins cannot be ratedbanned.\n')) if u.is_ratedbanned: raise ListError(_('%s is already on the ratedban list.\n') % u.name) u.set_ratedbanned(True) db.add_comment(conn.user.id, u.id, 'Ratedbanned.') self._notify_added(conn, u)
def run(self, args, conn): u = user.find_by_name_exact_for_user(args[0], conn) if u: if not admin.checker.check_user_operation(conn.user, u): conn.write("You need a higher adminlevel to nuke %s!\n" % u.name) elif not u.is_online: conn.write("%s is not logged in.\n" % u.name) else: u.write_('\n\n**** You have been kicked out by %s! ****\n\n', (conn.user.name,)) u.session.conn.loseConnection('nuked') if not u.is_guest: db.add_comment(conn.user.id, u.id, 'Nuked.') conn.write('Nuked: %s\n' % u.name)
def add(self, item, conn): self._require_admin(conn.user) u = user.find_by_prefix_for_user(item, conn) if u: if u.is_guest: raise ListError( A_('Only registered players can be ratedbanned.\n')) if u.is_admin(): raise ListError(A_('Admins cannot be ratedbanned.\n')) if u.is_ratedbanned: raise ListError( _('%s is already on the ratedban list.\n') % u.name) u.set_ratedbanned(True) db.add_comment(conn.user.id, u.id, 'Ratedbanned.') self._notify_added(conn, u)
def run(self, args, conn): u = user.find_by_prefix_for_user(args[0], conn) if u: if not admin.checker.check_user_operation(conn.user, u): conn.write("You need a higher adminlevel to change the real name of %s.\n" % u.name) return if u.is_guest: conn.write(A_('You can only set the real name of registered players.\n')) return real_name = args[1] if real_name is None: # TODO? assert(False) else: old_real_name = u.real_name u.set_real_name(real_name) db.add_comment(conn.user.id, u.id, 'Changed real name from "%s" to "%s".' % (old_real_name, real_name)) if u.is_online: u.write_('%(aname)s has changed your real name to "%(real_name)s".\n', {'aname': conn.user.name, 'real_name': real_name}) conn.write(A_('Real name of %(uname)s changed to "%(real_name)s".\n') % {'uname': u.name, 'real_name': real_name})