summaryrefslogtreecommitdiffstats
path: root/modules/core/docs/authproc_attributevaluemap.md
blob: cf7468a5f4ff2b9537777c08d3ad1dd2e1b89427 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
`core:AttributeValueMap`
===================

Filter that creates a target attribute based on one or more value(s) in source attribute.

%replace can be used to replace all existing values in target with new ones (any existing values will be lost)
%keep can be used to keep the source attribute, otherwise it will be removed.

Examples
--------

Add student affiliation based on LDAP groupmembership.
Will add eduPersonAffiliation containing value "student" if memberOf attribute contains
either 'cn=student,o=some,o=organization,dc=org' or 'cn=student,o=other,o=organization,dc=org'.
'memberOf' attribute will be removed (use %keep, to keep it) and existing values in
'eduPersonAffiliation' will be merged (use %replace to replace them).

    'authproc' => array(
        50 => array(
            'class' => 'core:AttributeValueMap',
            'sourceattribute' => 'memberOf',
            'targetattribute' => 'eduPersonAffiliation',
            'values' => array(
                'student' => array(
                    'cn=student,o=some,o=organization,dc=org',
                    'cn=student,o=other,o=organization,dc=org',
                ),
            ),
        ),
    )

Multiple assignments.
Add student, employee and both affiliation based on LDAP groupmembership in memberOf attribute.

    'authproc' => array(
        50 => array(
            'class' => 'core:AttributeValueMap',
            'sourceattribute' => 'memberOf',
            'targetattribute' => 'eduPersonAffiliation',
            'values' => array(
                'student' => array(
                    'cn=student,o=some,o=organization,dc=org',
                    'cn=student,o=other,o=organization,dc=org',
                ),
                'employee' => array(
                    'cn=employees,o=some,o=organization,dc=org',
                    'cn=employee,o=other,o=organization,dc=org',
                    'cn=workers,o=any,o=organization,dc=org',
                ),
                'both' => array(
                    'cn=student,o=some,o=organization,dc=org',
                    'cn=student,o=other,o=organization,dc=org',
                    'cn=employees,o=some,o=organization,dc=org',
                    'cn=employee,o=other,o=organization,dc=org',
                    'cn=workers,o=any,o=organization,dc=org',
                ),
            ),
        ),
    )

Replace and Keep.
Replace any existing 'affiliation' attribute values and keep 'groups' attribute.
    
    'authproc' => array(
        50 => array(
            'class' => 'core:AttributeValueMap',
            'sourceattribute' => 'groups',
            'targetattribute' => 'affiliation',
            '%replace',
            '%keep',
            'values' => array(
                'student' => array(
                    'cn=student,o=some,o=organization,dc=org',
                    'cn=student,o=other,o=organization,dc=org',
                ),
                'employee' => array(
                    'cn=employees,o=some,o=organization,dc=org',
                    'cn=employee,o=other,o=organization,dc=org',
                    'cn=workers,o=any,o=organization,dc=org',
                ),
            ),
        ),
    )