'build map of permissions at level 0'

def build_perm_map(self):

    self.perm_map = {}
    for r in get_valid_perms():
        dt = r[u'parent']
        if (not (dt in self.perm_map)):
            self.perm_map[dt] = {}
        for k in frappe.permissions.rights:
            if (not self.perm_map[dt].get(k)):
                self.perm_map[dt][k] = r.get(k)
