service-filter.drl 5.73 KB
Newer Older
1
2
3
4
5
6
package edu.kit.scc.webreg.drools.sf;

import edu.kit.scc.webreg.entity.UserEntity;
import edu.kit.scc.webreg.entity.GroupEntity;
import edu.kit.scc.webreg.entity.LocalGroupEntity;
import edu.kit.scc.webreg.entity.ServiceEntity;
michael.simon's avatar
michael.simon committed
7
import edu.kit.scc.webreg.entity.SamlIdpMetadataEntity;
8
9
10

global org.slf4j.Logger logger;

michael.simon's avatar
michael.simon committed
11
12
13
14
15
16
17
18
19
20
21
22
rule "FH1 Filter"

    when
        $user : UserEntity()
        $service : ServiceEntity( shortName == "fh1" )
        $group : LocalGroupEntity( name == "fh1-access" )
    then
    	logger.debug( "allow user {} for service {}, because of membership in group {}", $user.getEppn(), $service.getName(), $group.getName() );
    	retract( $service );

end

michael.simon's avatar
michael.simon committed
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
rule "FH2 Filter"

    when
        $user : UserEntity()
        $service : ServiceEntity( shortName == "fh2" )
        $group : LocalGroupEntity( name == "fh2-access" )
    then
    	logger.debug( "allow user {} for service {}, because of membership in group {}", $user.getEppn(), $service.getName(), $group.getName() );
    	retract( $service );

end

rule "FHC Filter"

    when
        $user : UserEntity()
        $service : ServiceEntity( shortName == "fhc" )
        $group : LocalGroupEntity( name == "fhc-access" )
    then
    	logger.debug( "allow user {} for service {}, because of membership in group {}", $user.getEppn(), $service.getName(), $group.getName() );
    	retract( $service );

end

michael.simon's avatar
michael.simon committed
47
rule "UC1 Filter"
48
49

    when
michael.simon's avatar
michael.simon committed
50
51
52
53
        $user : UserEntity( ( idp.getEntityCategoryList() contains "http://aai.dfn.de/category/bwidm-member" )
        	&& 
        	( attributeStore["urn:oid:1.3.6.1.4.1.5923.1.1.1.7"] 
        		matches ".*(^|;)http://bwidm.de/entitlement/bwUniCluster(;|$).*" ) )
michael.simon's avatar
michael.simon committed
54
        $service : ServiceEntity( shortName == "bwuc" )
michael.simon's avatar
michael.simon committed
55
56
57
58
59
60
61
62
63
64
65
66
67
    then
    	logger.debug( "allow user {} for service {}, because of entitlement", $user.getEppn(), $service.getName() );
    	retract( $service );

end

rule "UCB Filter"

    when
        $user : UserEntity( ( idp.getEntityCategoryList() contains "http://aai.dfn.de/category/bwidm-member" )
        	&& 
        	( attributeStore["urn:oid:1.3.6.1.4.1.5923.1.1.1.7"] 
        		matches ".*(^|;)http://bwidm.de/entitlement/bwUniClusterTest(;|$).*" ) )
68
69
        $service : ServiceEntity( shortName == "ucb" )
    then
michael.simon's avatar
michael.simon committed
70
    	logger.debug( "allow user {} for service {}, because of entitlement", $user.getEppn(), $service.getName() );
71
72
73
74
    	retract( $service );

end

michael.simon's avatar
michael.simon committed
75
rule "HC3 Filter"
76
77

    when
michael.simon's avatar
michael.simon committed
78
79
80
81
82
        $user : UserEntity( ( idp.entityId == "https://idp.scc.kit.edu/idp/shibboleth" ) 
        	&& 
        	( attributeStore["urn:oid:1.3.6.1.4.1.5923.1.1.1.7"] 
        		matches ".*(^|;)http://bwidm.scc.kit.edu/entitlement/hc3(;|$).*" ) )
        $service : ServiceEntity( shortName == "hc3" )
83
    then
michael.simon's avatar
michael.simon committed
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
    	logger.debug( "allow user {} for service {}, because of entitlement", $user.getEppn(), $service.getName() );
    	retract( $service );

end

rule "HCD Filter"

    when
        $user : UserEntity( ( idp.entityId == "https://idp.scc.kit.edu/idp/shibboleth" ) 
        	&& 
        	( attributeStore["urn:oid:1.3.6.1.4.1.5923.1.1.1.7"] 
        		matches ".*(^|;)http://bwidm.scc.kit.edu/entitlement/hcd(;|$).*" ) )
        $service : ServiceEntity( shortName == "hcd" )
    then
    	logger.debug( "allow user {} for service {}, because of entitlement", $user.getEppn(), $service.getName() );
    	retract( $service );

end

rule "IC2 Filter"

    when
        $user : UserEntity( ( idp.entityId == "https://idp.scc.kit.edu/idp/shibboleth" ) 
        	&& 
        	( attributeStore["urn:oid:1.3.6.1.4.1.5923.1.1.1.7"] 
        		matches ".*(^|;)http://bwidm.scc.kit.edu/entitlement/ic2(;|$).*" ) )
        $service : ServiceEntity( shortName == "ic2" )
    then
    	logger.debug( "allow user {} for service {}, because of entitlement", $user.getEppn(), $service.getName() );
    	retract( $service );

end

rule "ICC Filter"

    when
        $user : UserEntity( ( idp.entityId == "https://idp.scc.kit.edu/idp/shibboleth" ) 
        	&& 
        	( attributeStore["urn:oid:1.3.6.1.4.1.5923.1.1.1.7"] 
        		matches ".*(^|;)http://bwidm.scc.kit.edu/entitlement/icc(;|$).*" ) )
        $service : ServiceEntity( shortName == "icc" )
    then
    	logger.debug( "allow user {} for service {}, because of entitlement", $user.getEppn(), $service.getName() );
127
128
129
    	retract( $service );

end
michael.simon's avatar
michael.simon committed
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169

rule "bwFileStorage Filter"

    when
        $user : UserEntity( idp.getEntityCategoryList() contains "http://aai.dfn.de/category/bwidm-member" )
        $service : ServiceEntity( shortName == "lsdf-file" )
    then
    	logger.debug( "allow user {} for service {}, because of entitlement", $user.getEppn(), $service.getName() );
    	retract( $service );

end

rule "bwSNS Filter"

    when
        $user : UserEntity( ( idp.getEntityCategoryList() contains "http://aai.dfn.de/category/bwidm-member" )
        	&& 
        	( attributeStore["urn:oid:1.3.6.1.4.1.5923.1.1.1.7"] 
        		matches ".*(^|;)http://bwidm.de/entitlement/bwLSDF-SyncShare(;|$).*" ) )
        $service : ServiceEntity( shortName == "sns" )
    then
    	logger.debug( "allow user {} for service {}, because of entitlement", $user.getEppn(), $service.getName() );
    	retract( $service );

end

rule "LSDF-DIS Filter"

    when
        $user : UserEntity( ( idp.entityId == "https://idp.scc.kit.edu/idp/shibboleth" ) 
        	&& 
        	( attributeStore["urn:oid:1.3.6.1.4.1.5923.1.1.1.7"] 
        		matches ".*(^|;)http://bwidm.scc.kit.edu/entitlement/lsdf-dis(;|$).*" ) )
        $service : ServiceEntity( shortName == "lsdfdis" )
    then
    	logger.debug( "allow user {} for service {}, because of entitlement", $user.getEppn(), $service.getName() );
    	retract( $service );

end