1290 |
1290 |
1291 @objectify_predicate |
1291 @objectify_predicate |
1292 def no_cnx(cls, req, **kwargs): |
1292 def no_cnx(cls, req, **kwargs): |
1293 """Return 1 if the web session has no connection set. This occurs when |
1293 """Return 1 if the web session has no connection set. This occurs when |
1294 anonymous access is not allowed and user isn't authenticated. |
1294 anonymous access is not allowed and user isn't authenticated. |
1295 |
|
1296 May only be used on the web side, not on the data repository side. |
|
1297 """ |
1295 """ |
1298 if not req.cnx: |
1296 if not req.cnx: |
1299 return 1 |
1297 return 1 |
1300 return 0 |
1298 return 0 |
1301 |
1299 |
1302 |
1300 |
1303 @objectify_predicate |
1301 @objectify_predicate |
1304 def authenticated_user(cls, req, **kwargs): |
1302 def authenticated_user(cls, req, **kwargs): |
1305 """Return 1 if the user is authenticated (i.e. not the anonymous user). |
1303 """Return 1 if the user is authenticated (i.e. not the anonymous user). |
1306 |
|
1307 May only be used on the web side, not on the data repository side. |
|
1308 """ |
1304 """ |
1309 if req.session.anonymous_session: |
1305 if req.session.anonymous_session: |
1310 return 0 |
1306 return 0 |
1311 return 1 |
1307 return 1 |
1312 |
1308 |
1313 |
1309 |
1314 @objectify_predicate |
1310 @objectify_predicate |
1315 def anonymous_user(cls, req, **kwargs): |
1311 def anonymous_user(cls, req, **kwargs): |
1316 """Return 1 if the user is not authenticated (i.e. is the anonymous user). |
1312 """Return 1 if the user is not authenticated (i.e. is the anonymous user). |
1317 |
|
1318 May only be used on the web side, not on the data repository side. |
|
1319 """ |
1313 """ |
1320 if req.session.anonymous_session: |
1314 if req.session.anonymous_session: |
1321 return 1 |
1315 return 1 |
1322 return 0 |
1316 return 0 |
1323 |
1317 |