Module: sip-router
Branch: master
Commit: a9caef9ac75b946b4e9d0fd0ca81d0625353528c
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a9caef9…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu Sep 30 14:40:26 2010 +0200
xcap_server: enhaced sample config in readme
- refresh watchers also for delete (reported by Inaki Baz Castillo)
- check if authenticated user matches the user part in xuid, in this way
an user is allowed to access and manage only its documents
---
modules_k/xcap_server/README | 16 ++++++++++++++++
modules_k/xcap_server/doc/xcap_server_admin.xml | 16 ++++++++++++++++
2 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/modules_k/xcap_server/README b/modules_k/xcap_server/README
index 681f194..0041177 100644
--- a/modules_k/xcap_server/README
+++ b/modules_k/xcap_server/README
@@ -338,11 +338,22 @@ event_route[xhttp:request] {
"$var(xbody)");
exit;
}
+ # be sure auth user access only its documents
+ if ($au!=$(var(uri){uri.user})) {
+ xhttp_reply("403", "Forbidden", "text/html",
+ "operation not allowed");
+ exit;
+ }
xdbg("SCRIPT: xcap service $xcapuri(u=>auid) for
$xcapuri(u=>xuid)\n");
switch($rm) {
case "PUT":
xcaps_put("$var(uri)", "$hu", "$rb");
+ if($xcapuri(u=>auid)=~"pres-rules")
+ {
+ pres_update_watchers("$var(uri)", "presence");
+ pres_refresh_watchers("$var(uri)", "presence",
1);
+ }
exit;
break;
case "GET":
@@ -351,6 +362,11 @@ event_route[xhttp:request] {
break;
case "DELETE":
xcaps_del("$var(uri)", "$hu");
+ if($xcapuri(u=>auid)=~"pres-rules")
+ {
+ pres_update_watchers("$var(uri)", "presence");
+ pres_refresh_watchers("$var(uri)", "presence",
1);
+ }
exit;
break;
}
diff --git a/modules_k/xcap_server/doc/xcap_server_admin.xml
b/modules_k/xcap_server/doc/xcap_server_admin.xml
index 95ff2a0..7d8eef8 100644
--- a/modules_k/xcap_server/doc/xcap_server_admin.xml
+++ b/modules_k/xcap_server/doc/xcap_server_admin.xml
@@ -390,11 +390,22 @@ event_route[xhttp:request] {
"$var(xbody)");
exit;
}
+ # be sure auth user access only its documents
+ if ($au!=$(var(uri){uri.user})) {
+ xhttp_reply("403", "Forbidden", "text/html",
+ "operation not allowed");
+ exit;
+ }
xdbg("SCRIPT: xcap service $xcapuri(u=>auid) for
$xcapuri(u=>xuid)\n");
switch($rm) {
case "PUT":
xcaps_put("$var(uri)", "$hu", "$rb");
+ if($xcapuri(u=>auid)=~"pres-rules")
+ {
+ pres_update_watchers("$var(uri)", "presence");
+ pres_refresh_watchers("$var(uri)", "presence",
1);
+ }
exit;
break;
case "GET":
@@ -403,6 +414,11 @@ event_route[xhttp:request] {
break;
case "DELETE":
xcaps_del("$var(uri)", "$hu");
+ if($xcapuri(u=>auid)=~"pres-rules")
+ {
+ pres_update_watchers("$var(uri)", "presence");
+ pres_refresh_watchers("$var(uri)", "presence",
1);
+ }
exit;
break;
}