Beispiel #1
0
def settings_for_object(ob):
    """Analysis tool to show all of the grants to a process
    """
    result = []
    while ob is not None:
        data = {}
        result.append({getattr(ob, '__name__', None) or '(no name)': data})

        principal_permissions = IPrincipalPermissionMap(ob, None)
        if principal_permissions is not None:
            settings = principal_permissions.get_principals_and_permissions()
            settings.sort()
            data['prinperm'] = [
                {'principal': pr, 'permission': p, 'setting': s}
                for (p, pr, s) in settings]

        principal_roles = IPrincipalRoleMap(ob, None)
        if principal_roles is not None:
            settings = principal_roles.get_principals_and_roles()
            data['prinrole'] = [
                {'principal': p, 'role': r, 'setting': s}
                for (r, p, s) in settings]

        role_permissions = IRolePermissionMap(ob, None)
        if role_permissions is not None:
            settings = role_permissions.get_roles_and_permissions()
            data['roleperm'] = [
                {'permission': p, 'role': r, 'setting': s}
                for (p, r, s) in settings]

        ob = getattr(ob, '__parent__', None)

    data = {}
    result.append({'system': data})

    settings = principal_permission_manager.get_principals_and_permissions()
    settings.sort()
    data['prinperm'] = [
        {'principal': pr, 'permission': p, 'setting': s}
        for (p, pr, s) in settings]

    settings = principal_role_manager.get_principals_and_roles()
    data['prinrole'] = [
        {'principal': p, 'role': r, 'setting': s}
        for (r, p, s) in settings]

    settings = role_permission_manager.get_roles_and_permissions()
    data['roleperm'] = [
        {'permission': p, 'role': r, 'setting': s}
        for (p, r, s) in settings]

    return result
Beispiel #2
0
def settings_for_object(ob):
    """Analysis tool to show all of the grants to a process
    """
    result = []

    locked_permissions = []
    while ob is not None:
        data = {}
        result.append({getattr(ob, "__name__", None) or "(no name)": data})

        principal_permissions = IPrincipalPermissionMap(ob, None)
        if principal_permissions is not None:
            settings = principal_permissions.get_principals_and_permissions()
            settings.sort()
            data["prinperm"] = [{
                "principal": pr,
                "permission": p,
                "setting": s
            } for (p, pr, s) in settings]

        principal_roles = IPrincipalRoleMap(ob, None)
        if principal_roles is not None:
            settings = principal_roles.get_principals_and_roles()
            data["prinrole"] = [{
                "principal": p,
                "role": r,
                "setting": s
            } for (r, p, s) in settings]

        role_permissions = IRolePermissionMap(ob, None)
        if role_permissions is not None:
            settings = role_permissions.get_roles_and_permissions()
            data["roleperm"] = [{
                "permission": p,
                "role": r,
                "setting": s
            } for (p, r, s) in settings if p not in locked_permissions]

        inherit_permissions = IInheritPermissionMap(ob)
        if inherit_permissions is not None:
            settings = inherit_permissions.get_locked_permissions()
            data["perminhe"] = []
            for (p, s) in settings:
                if s is Deny:
                    locked_permissions.append(p)
                data["perminhe"].append({"permission": p, "setting": s})

        ob = getattr(ob, "__parent__", None)

    data = {}
    result.append({"system": data})

    settings = principal_permission_manager.get_principals_and_permissions()
    settings.sort()
    data["prinperm"] = [{
        "principal": pr,
        "permission": p,
        "setting": s
    } for (p, pr, s) in settings]

    settings = principal_role_manager.get_principals_and_roles()
    data["prinrole"] = [{
        "principal": p,
        "role": r,
        "setting": s
    } for (r, p, s) in settings]

    settings = role_permission_manager.get_roles_and_permissions()
    data["roleperm"] = [{
        "permission": p,
        "role": r,
        "setting": s
    } for (p, r, s) in settings if p not in locked_permissions]

    return result
Beispiel #3
0
def settings_for_object(ob):
    """Analysis tool to show all of the grants to a process
    """
    result = []

    locked_permissions = []
    while ob is not None:
        data = {}
        result.append({getattr(ob, '__name__', None) or '(no name)': data})

        principal_permissions = IPrincipalPermissionMap(ob, None)
        if principal_permissions is not None:
            settings = principal_permissions.get_principals_and_permissions()
            settings.sort()
            data['prinperm'] = [
                {'principal': pr, 'permission': p, 'setting': s}
                for (p, pr, s) in settings]

        principal_roles = IPrincipalRoleMap(ob, None)
        if principal_roles is not None:
            settings = principal_roles.get_principals_and_roles()
            data['prinrole'] = [
                {'principal': p, 'role': r, 'setting': s}
                for (r, p, s) in settings]

        role_permissions = IRolePermissionMap(ob, None)
        if role_permissions is not None:
            settings = role_permissions.get_roles_and_permissions()
            data['roleperm'] = [
                {'permission': p, 'role': r, 'setting': s}
                for (p, r, s) in settings if p not in locked_permissions]

        inherit_permissions = IInheritPermissionMap(ob)
        if inherit_permissions is not None:
            settings = inherit_permissions.get_locked_permissions()
            data['perminhe'] = []
            for (p, s) in settings:
                if s is Deny:
                    locked_permissions.append(p)
                data['perminhe'].append({'permission': p, 'setting': s})

        ob = getattr(ob, '__parent__', None)

    data = {}
    result.append({'system': data})

    settings = principal_permission_manager.get_principals_and_permissions()
    settings.sort()
    data['prinperm'] = [
        {'principal': pr, 'permission': p, 'setting': s}
        for (p, pr, s) in settings]

    settings = principal_role_manager.get_principals_and_roles()
    data['prinrole'] = [
        {'principal': p, 'role': r, 'setting': s}
        for (r, p, s) in settings]

    settings = role_permission_manager.get_roles_and_permissions()
    data['roleperm'] = [
        {'permission': p, 'role': r, 'setting': s}
        for (p, r, s) in settings if p not in locked_permissions]

    return result