Exemplo n.º 1
0
def getPerm(imap, cl):
  """TODO"""

  if len(cl) == 0:
    print "USAGE: getperm user pattern"
  else:
    args = cl.split(" ", 2)
    user = args[0]
    if len(args) > 1:
      pattern = strip(args[1])
    else:
      pattern = "*"

    print "%s:" % (user)
    mailboxes = imap.list(pattern)
    for mailbox in mailboxes:
      acl = imap.getacl(mailbox[0])
      for a in acl:
        if a[0] == user:
          print "  %s %s" % (utf_7_imap_decode(mailbox[0])[0], a[1])
Exemplo n.º 2
0
def getACL(imap, cl):
  """TODO"""

  if len(cl) == 0:
    print "USAGE: getacl [-r] mailbox"
  else:
    args = split(cl)
    if args[0] == "-r":
      recursive = True
      args = args[1:]
    else:
      recursive = False
    
    for mailbox in args:
      if recursive:
        mailboxes = map(lambda m: m[0], imap.list(mailbox))
      else:
        mailboxes = [mailbox]
      for mb in mailboxes:
        acls = imap.getacl(mb)

        print "%s:" % utf_7_imap_decode(mb)[0]
        for acl in acls:
          print "  %s %s" % (acl[0], acl[1])