def perm(event):
    """ add/change permissions of an user. """
    from bot.space import fleet, users
    if not users.allowed(event.origin, 'OPER'):
        event.reply('you are not allowed to give the perm command.')
        return
    try:
        nick, perms = event._parsed.args
    except:
        event.reply('perm <origin> <perm>')
        return
    origin = fleet.get_origin(nick)
    user = users.set(origin, perms)
    if not user:
        event.reply("can't find a user matching %s" % origin)
        return
    event.reply(slice(user, skip=['type']))
