source: ISOcat/trunk/mod-ISOcat-manage-access/manage/cr.acc @ 2029

Last change on this file since 2029 was 2029, checked in by mwindhouwer, 12 years ago

Initial import of all the *cats, i.e., ISOcat, RELcat and SCHEMAcat.

File size: 3.4 KB
Line 
1<accessor debug="false">
2        <name>ISOcat.manage.access.cr</name>
3        <descr>Check if the user indicated by the credentials is allowed to access this CR.</descr>
4        <param manadatory="true">
5                <name>cr</name>
6                <descr>the CR</descr>
7                <source>
8                        <param/>
9                        <nvp/>
10                        <session/>
11                </source>
12                <type canonical="true">string</type>
13        </param>
14        <param mandatory="true">
15                <name>credentials</name>
16                <descr>the credentials of the user trying to access the DC</descr>
17                <type canonical="true">string</type>
18        </param>
19        <idoc>
20                <accessor-debug>
21                        <instr>
22                                <type>sloot.log</type>
23                                <operator>
24                                        <msg>DBG:.....:ISOcat.manage.access.cr(CR[{string($cr)}],credentials[{string($credentials)}])</msg>
25                                </operator>
26                                <cr>var:cr</cr>
27                                <credentials>var:credentials</credentials>
28                        </instr>
29                </accessor-debug>
30                <instr>
31                        <type>copy</type>
32                        <operand>
33                                <string/>
34                        </operand>
35                        <target>var:mode</target>
36                </instr>
37                <!-- check if the credentials are a valid pair -->
38                <instr>
39                        <type>ISOcat.access.data.credentials</type>
40                        <credentials>var:credentials</credentials>
41                        <target>var:access</target>
42                </instr>
43                <!-- check if the user has access to the CR -->
44                <if>
45                        <cond>
46                                <instr>
47                                        <type>copy</type>
48                                        <operand>var:access</operand>
49                                        <target>this:cond</target>
50                                </instr>
51                        </cond>
52                        <then>
53                                <instr>
54                                        <type>sloot.xpath2eval</type>
55                                        <operand>var:credentials</operand>
56                                        <operator>
57                                                <xpath>substring-before(.,':')</xpath>
58                                        </operator>
59                                        <param>
60                                                <return>
61                                                        <canonical/>
62                                                        <string/>
63                                                </return>
64                                        </param>
65                                        <target>var:user</target>
66                                </instr>
67                                <instr>
68                                        <type>ISOcat.manage.user.id</type>
69                                        <user>var:user</user>
70                                        <target>var:uid</target>
71                                </instr>
72                                <instr>
73                                        <type>ISOcat.manage.cr.scope</type>
74                                        <cr>var:cr</cr>
75                                        <target>var:scope</target>
76                                </instr>
77                                <instr>
78                                        <type>sloot.xquery</type>
79                                        <operator>
80                                                <string>
81                                                {
82                                                        if      (exists($scope//account[@ref=string($uid)]))
83                                                        then    (string(($scope//account[@ref=string($uid)])[last()]/@rights))
84                                                        else    ('')
85                                                }
86                                                </string>
87                                        </operator>
88                                        <scope>var:scope</scope>
89                                        <uid>var:uid</uid>
90                                        <target>var:mode</target>
91                                </instr>
92                                <accessor-debug>
93                                        <instr>
94                                                <type>sloot.log</type>
95                                                <operator>
96                                                        <msg>DBG:.....:ISOcat.manage.access.cr(CR[{string($cr)}],credentials[{string($credentials)}]):CR access mode:{string($mode)}</msg>
97                                                </operator>
98                                                <cr>var:cr</cr>
99                                                <credentials>var:credentials</credentials>
100                                                <mode>var:mode</mode>
101                                        </instr>
102                                </accessor-debug>
103                        </then>
104                        <else>
105                                <accessor-debug>
106                                        <instr>
107                                                <type>sloot.log</type>
108                                                <operator>
109                                                        <msg>DBG:.....:ISOcat.manage.access.cr(CR[{string($cr)}],credentials[{string($credentials)}]):invalid credentials</msg>
110                                                </operator>
111                                                <cr>var:cr</cr>
112                                                <credentials>var:credentials</credentials>
113                                                <target>var:msg</target>
114                                        </instr>
115                                        <instr>
116                                                <type>sloot.log</type>
117                                                <operand>var:msg</operand>
118                                        </instr>
119                                </accessor-debug>
120                        </else>
121                </if>
122                <instr>
123                        <type>copy</type>
124                        <operand>var:mode</operand>
125                        <target>this:response</target>
126                </instr>
127        </idoc>
128        <exception>
129                <debug/>
130                <trace>ffcpl:/trace/cr.exception.xml</trace>
131                <response>
132                        <string/>
133                </response>
134        </exception>
135        <response>
136                <debug>ffcpl:/trace/cr.response.xml</debug>
137                <mime>application/xml</mime>
138        </response>
139</accessor>
Note: See TracBrowser for help on using the repository browser.