コード例 #1
0
def group_acl_report(group_name):
    """
    Display a table of items and permissions, where the ACL rule specifies any
    WikiGroup or ConfigGroup name.
    """
    query = And([
        Term(WIKINAME, app.cfg.interwikiname),
        Not(Term(NAMESPACE, NAMESPACE_USERPROFILES))
    ])
    all_metas = flaskg.storage.search_meta(query,
                                           idx_name=LATEST_REVS,
                                           sortedby=[NAMESPACE, NAME],
                                           limit=None)
    group_items = []
    for meta in all_metas:
        acl_iterator = ACLStringIterator(ACL_RIGHTS_CONTENTS,
                                         meta.get(ACL, ''))
        for modifier, entries, rights in acl_iterator:
            if group_name in entries:
                fqname = gen_fqnames(meta)
                group_items.append(
                    dict(name=meta.get(NAME),
                         itemid=meta.get(ITEMID),
                         namespace=meta.get(NAMESPACE),
                         fqname=fqname,
                         rights=rights))
    return render_template('admin/group_acl_report.html',
                           title_name=_('Group ACL Report'),
                           group_items=group_items,
                           group_name=group_name)
コード例 #2
0
def group_acl_report(group_name):
    """
    Display a 2-column table of items and ACLs, where the ACL rule specifies any
    WikiGroup or ConfigGroup name.
    """
    group = search_group(group_name)
    all_items = flaskg.storage.documents(wikiname=app.cfg.interwikiname)
    group_items = []
    for item in all_items:
        acl_iterator = ACLStringIterator(ACL_RIGHTS_CONTENTS,
                                         item.meta.get(ACL, ''))
        for modifier, entries, rights in acl_iterator:
            if group_name in entries:
                item_id = item.meta.get(ITEMID)
                fqname = CompositeName(item.meta.get(NAMESPACE), u'itemid',
                                       item_id)
                group_items.append(
                    dict(name=item.meta.get(NAME),
                         itemid=item_id,
                         fqname=fqname,
                         rights=rights))
    return render_template('admin/group_acl_report.html',
                           title_name=_(u'Group ACL Report'),
                           group_items=group_items,
                           group_name=group_name)
コード例 #3
0
def acliter(acl):
    """
    return a acl string iterator (using cfg.acl_rights_contents as valid acl rights)
    """
    return ACLStringIterator(app.cfg.acl_rights_contents, acl)