aboutsummaryrefslogtreecommitdiff
path: root/utils/mangle-jobs/project-based-sec-add.mangle
blob: d59faaf5450f885569f773016c2154b31eb05657 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Add default project-based security setting for project (anon read access)

from lxml.etree import fromstring
from mangle_helper import *

new_node = """\
    <hudson.security.AuthorizationMatrixProperty>
      <permission>hudson.model.Item.Read:anonymous</permission>
    </hudson.security.AuthorizationMatrixProperty>
"""

def mangle(tree):
    if tree.xpath("//properties/hudson.security.AuthorizationMatrixProperty"):
        # Needed config already there - don't change
        return False

    add_child(tree, "/project/properties", new_node)