diff options
author | B. Stack <bgstack15@gmail.com> | 2022-05-19 11:59:20 -0400 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2022-05-19 11:59:20 -0400 |
commit | d9ddf89b32a1514248f0943e72f704a8bcb523e4 (patch) | |
tree | 030a8a75f76f2ef00053fd1854458901fbf9c939 /radicale_infcloud/web | |
parent | symlink /etc/infcloud/cache.manifest (diff) | |
download | radicaleinfcloud-d9ddf89b32a1514248f0943e72f704a8bcb523e4.tar.gz radicaleinfcloud-d9ddf89b32a1514248f0943e72f704a8bcb523e4.tar.bz2 radicaleinfcloud-d9ddf89b32a1514248f0943e72f704a8bcb523e4.zip |
add perUserAdditionalResources support
This allows per-user additional calendars, for viewing shared
items.
Diffstat (limited to 'radicale_infcloud/web')
-rw-r--r-- | radicale_infcloud/web/config.js | 6 | ||||
-rw-r--r-- | radicale_infcloud/web/webdav_protocol.js | 39 |
2 files changed, 38 insertions, 7 deletions
diff --git a/radicale_infcloud/web/config.js b/radicale_infcloud/web/config.js index b3b15f6..fd1c43a 100644 --- a/radicale_infcloud/web/config.js +++ b/radicale_infcloud/web/config.js @@ -347,7 +347,11 @@ var globalNetworkCheckSettings={ hrefLabel: null, forceReadOnly: null, ignoreAlarms: false, - backgroundCalendars: [] + backgroundCalendars: [], + perUserAdditionalResources: [ + { name: "bgstack15", allowed: ["name2","name3"] }, + { name: "name2", allowed: ["name4"] } + ] } diff --git a/radicale_infcloud/web/webdav_protocol.js b/radicale_infcloud/web/webdav_protocol.js index 93ce885..d64139c 100644 --- a/radicale_infcloud/web/webdav_protocol.js +++ b/radicale_infcloud/web/webdav_protocol.js @@ -18,6 +18,7 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ +// 2022-05-19 Stackrpms by removing all globalSettings.settingsAccount checks (but particularly at lines 1047, 1144, 1359), the "additionalResources" will load now. // VersionCheck (check for new version) function netVersionCheck() @@ -152,6 +153,30 @@ function netCheckAndCreateConfiguration(configurationURL) } } } + // stackrpms,23 Add perUserAdditionalResources feature + if(configurationURL.perUserAdditionalResources!=undefined && configurationURL.perUserAdditionalResources.length>0) + { + for(var j=0;j<configurationURL.perUserAdditionalResources.length;j++) + { + if(configurationURL.perUserAdditionalResources[j].name!=undefined && configurationURL.perUserAdditionalResources[j].name == globalLoginUsername) + { + if(configurationURL.perUserAdditionalResources[j].allowed!=undefined && configurationURL.perUserAdditionalResources[j].allowed.length>0) + { + for(var i=0;i<configurationURL.perUserAdditionalResources[j].allowed.length;i++) + { + if(globalLoginUsername!=configurationURL.perUserAdditionalResources[j].allowed[i] && (configurationURL.additionalResources==undefined || configurationURL.additionalResources.indexOf(configurationURL.perUserAdditionalResources[j].allowed[i])==-1)) + { + globalAccountSettings[globalAccountSettings.length]=$.extend({}, configurationURL); + globalAccountSettings[globalAccountSettings.length-1].type='network'; + globalAccountSettings[globalAccountSettings.length-1].href=configurationURL.href+configurationURL.perUserAdditionalResources[j].allowed[i]+'/'; + globalAccountSettings[globalAccountSettings.length-1].userAuth={userName: globalLoginUsername, userPassword: globalLoginPassword}; + count++; + } + } + } + } + } + } } if(count) @@ -500,7 +525,7 @@ function DAVresourceDelegation(inputResource, index, lastIndex) var delegationXML=''; if(typeof inputResource.extendedDelegation!='undefined' && inputResource.extendedDelegation) { - if(inputResource.href.indexOf(globalLoginUsername)!=-1 && inputResource.settingsAccount && (globalSettings.settingstype.value=='' || globalSettings.settingstype.value==null || (globalSettings.settingstype.value!='' && globalSettings.settingstype.value!=null && globalSettings.settingstype.value=='principal-URL'))) + if(inputResource.href.indexOf(globalLoginUsername)!=-1 && (globalSettings.settingstype.value=='' || globalSettings.settingstype.value==null || (globalSettings.settingstype.value!='' && globalSettings.settingstype.value!=null && globalSettings.settingstype.value=='principal-URL'))) settingsXML = '<D:property name="settings" namespace="http://inf-it.com/ns/dav/"/>'; delegationXML='<?xml version="1.0" encoding="utf-8"?><D:expand-property xmlns:D="DAV:"><D:property name="calendar-proxy-read-for" namespace="http://calendarserver.org/ns/"><D:property name="resourcetype"/><D:property name="current-user-privilege-set"/><D:property name="displayname"/><D:property name="calendar-user-address-set" namespace="urn:ietf:params:xml:ns:caldav"/><D:property name="calendar-home-set" namespace="urn:ietf:params:xml:ns:caldav"/><D:property name="addressbook-home-set" namespace="urn:ietf:params:xml:ns:carddav"/></D:property><D:property name="calendar-proxy-write-for" namespace="http://calendarserver.org/ns/"><D:property name="resourcetype"/><D:property name="current-user-privilege-set"/><D:property name="displayname"/><D:property name="calendar-user-address-set" namespace="urn:ietf:params:xml:ns:caldav"/><D:property name="calendar-home-set" namespace="urn:ietf:params:xml:ns:caldav"/><D:property name="addressbook-home-set" namespace="urn:ietf:params:xml:ns:carddav"/></D:property>'+settingsXML+'<D:property name="resourcetype"/><D:property name="current-user-privilege-set"/><D:property name="displayname"/><D:property name="calendar-user-address-set" namespace="urn:ietf:params:xml:ns:caldav"/><D:property name="calendar-home-set" namespace="urn:ietf:params:xml:ns:caldav"/><D:property name="addressbook-home-set" namespace="urn:ietf:params:xml:ns:carddav"/></D:expand-property>'; } @@ -565,7 +590,7 @@ function DAVresourceDelegation(inputResource, index, lastIndex) }); } - if(typeof inputResource.extendedDelegation!='undefined' && inputResource.extendedDelegation && !settingsLoaded && inputResource.href.indexOf(globalLoginUsername)!=-1 && inputResource.settingsAccount && (globalSettings.settingstype.value=='' || globalSettings.settingstype.value==null || (globalSettings.settingstype.value!='' && globalSettings.settingstype.value!=null && globalSettings.settingstype.value=='principal-URL'))) + if(typeof inputResource.extendedDelegation!='undefined' && inputResource.extendedDelegation && !settingsLoaded && inputResource.href.indexOf(globalLoginUsername)!=-1 && (globalSettings.settingstype.value=='' || globalSettings.settingstype.value==null || (globalSettings.settingstype.value!='' && globalSettings.settingstype.value!=null && globalSettings.settingstype.value=='principal-URL'))) { var settings=$(xml.responseXML).children().filterNsNode('multistatus').children().filterNsNode('response').children().filterNsNode('propstat').children().filterNsNode('prop').children().filterNsNode('settings').text(); if(settings!='') @@ -747,6 +772,8 @@ function netFindResource(inputResource, inputResourceIndex, forceLoad, indexR, l if(globalSettings.activecalendarcollections.value.length>0 && globalVisibleCalDAVCollections.length==0) globalDefaultCalendarCollectionActiveAll=true; } + // stackrpms,2 This forces all calendars to turn on at initial load + globalDefaultCalendarCollectionActiveAll=true; if(globalDefaultCalendarCollectionActiveAll) for(var i=0; i<globalResourceCalDAVList.collections.length; i++) @@ -1044,7 +1071,7 @@ function netFindResource(inputResource, inputResourceIndex, forceLoad, indexR, l var uidBase=tmp[1]+inputResource.userAuth.userName+'@'+tmp[2]; var uidFull=tmp[1]+inputResource.userAuth.userName+'@'+tmp[2]+tmp[3]; // for the error handler var settingsXML=''; - if(inputResource.href.indexOf(globalLoginUsername)!=-1 && inputResource.settingsAccount && (globalSettings.settingstype.value=='' || globalSettings.settingstype.value==null || (globalSettings.settingstype.value!='' && globalSettings.settingstype.value!=null && globalSettings.settingstype.value=='principal-URL'))) + if(inputResource.href.indexOf(globalLoginUsername)!=-1 && (globalSettings.settingstype.value=='' || globalSettings.settingstype.value==null || (globalSettings.settingstype.value!='' && globalSettings.settingstype.value!=null && globalSettings.settingstype.value=='principal-URL'))) settingsXML='<I:settings xmlns:I="http://inf-it.com/ns/dav/"/>'; var baseHref=tmp[1]+tmp[2]; @@ -1141,7 +1168,7 @@ function netFindResource(inputResource, inputResourceIndex, forceLoad, indexR, l if(isAvaible('CardDavMATE') && !globalCardDAVInitLoad) handleCardDAVError(false, inputResource); - if(!settingsLoaded && inputResource.href.indexOf(globalLoginUsername)!=-1 && inputResource.settingsAccount && (globalSettings.settingstype.value=='' || globalSettings.settingstype.value==null || (globalSettings.settingstype.value!='' && globalSettings.settingstype.value!=null && globalSettings.settingstype.value=='principal-URL'))) + if(!settingsLoaded && inputResource.href.indexOf(globalLoginUsername)!=-1 && (globalSettings.settingstype.value=='' || globalSettings.settingstype.value==null || (globalSettings.settingstype.value!='' && globalSettings.settingstype.value!=null && globalSettings.settingstype.value=='principal-URL'))) { var settings=$(xml.responseXML).children().filterNsNode('multistatus').children().filterNsNode('response').children().filterNsNode('propstat').children().filterNsNode('prop').children().filterNsNode('settings').text(); if(settings!='') @@ -1354,7 +1381,7 @@ function netLoadResource(inputResource, inputHref, hrefMode, inputResourceIndex, } var settingsXML=''; - if(inputResource.href.indexOf(globalLoginUsername)!=-1 && inputResource.settingsAccount && globalSettings.settingstype.value!='' && globalSettings.settingstype.value!=null) + if(inputResource.href.indexOf(globalLoginUsername)!=-1 && globalSettings.settingstype.value!='' && globalSettings.settingstype.value!=null) if((globalSettings.settingstype.value=='addressbook-home-set' && inputResource.abhref==inputHref) || (globalSettings.settingstype.value=='calendar-home-set' && inputResource.cahref==inputHref) || (globalSettings.settingstype.value=='principal-URL'&& ((isAvaible('CardDavMATE')&&globalCardDAVResourceSync) || (isAvaible('CalDavZAP')&&globalCalDAVResourceSync)))) settingsXML='<I:settings xmlns:I="http://inf-it.com/ns/dav/"/>'; @@ -1377,7 +1404,7 @@ function netLoadResource(inputResource, inputHref, hrefMode, inputResourceIndex, isHrefSet=false; var calendarNo=0; var resultTimestamp=new Date().getTime(); - if(!settingsLoaded && inputResource.href.indexOf(globalLoginUsername)!=-1 && inputResource.settingsAccount && globalSettings.settingstype.value!='' && globalSettings.settingstype.value!=null) + if(!settingsLoaded && inputResource.href.indexOf(globalLoginUsername)!=-1 && globalSettings.settingstype.value!='' && globalSettings.settingstype.value!=null) { if((globalSettings.settingstype.value=='addressbook-home-set' && inputResource.abhref==inputHref) || (globalSettings.settingstype.value=='calendar-home-set' && inputResource.cahref==inputHref)) { |