Merge pull request #2052 from maxberger/removelegacy
remove legacy bday sharing
This commit is contained in:
@@ -16,11 +16,9 @@
|
||||
# along with Radicale. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import base64
|
||||
import copy # TODO: remove/3.7.0-final
|
||||
import io
|
||||
import json
|
||||
import logging
|
||||
import os # TODO: remove/3.7.0-final
|
||||
import re
|
||||
import socket
|
||||
import uuid
|
||||
@@ -82,10 +80,6 @@ SHARE_TYPES: Sequence[str] = ('token', 'map', 'all')
|
||||
|
||||
SHARE_TYPES_V1: Sequence[str] = ('token', 'map')
|
||||
|
||||
if "SHARING_NO_LEGACY" not in os.environ: # TODO: remove/3.7.0-final
|
||||
SHARE_TYPES: Sequence[str] = ('token', 'map', 'bday', 'all') # type: ignore[no-redef] # TODO: remove/3.7.0-final
|
||||
SHARE_TYPES_V1: Sequence[str] = ('token', 'map', 'bday') # type: ignore[no-redef] # TODO: remove/3.7.0-final
|
||||
|
||||
API_HOOKS_V1: Sequence[str] = ('list', 'create', 'delete', 'update', 'hide', 'unhide', 'enable', 'disable', 'info')
|
||||
# list : list sharings (optional filtered)
|
||||
# create : create share by token or map
|
||||
@@ -163,12 +157,8 @@ class BaseSharing:
|
||||
# Sharing
|
||||
self.sharing_collection_by_map = configuration.get("sharing", "collection_by_map")
|
||||
self.sharing_collection_by_token = configuration.get("sharing", "collection_by_token")
|
||||
if "SHARING_NO_LEGACY" not in os.environ: # TODO: remove/3.7.0-final
|
||||
self.sharing_collection_by_map = self.sharing_collection_by_map or configuration.get("sharing", "collection_by_bday") # TODO: remove/3.7.0-final
|
||||
self.permit_create_token = configuration.get("sharing", "permit_create_token")
|
||||
self.permit_create_map = configuration.get("sharing", "permit_create_map")
|
||||
if "SHARING_NO_LEGACY" not in os.environ: # TODO: remove/3.7.0-final
|
||||
self.permit_create_map = self.permit_create_map or configuration.get("sharing", "permit_create_bday") # TODO: remove/3.7.0-final
|
||||
self.default_permissions_create_token = configuration.get("sharing", "default_permissions_create_token")
|
||||
self.default_permissions_create_map = configuration.get("sharing", "default_permissions_create_map")
|
||||
self.permit_properties_overlay = configuration.get("sharing", "permit_properties_overlay")
|
||||
@@ -843,11 +833,6 @@ class BaseSharing:
|
||||
answer['ApiVersion'] = 1
|
||||
Timestamp = int((datetime.now() - datetime(1970, 1, 1)).total_seconds())
|
||||
|
||||
if "SHARING_NO_LEGACY" not in os.environ: # TODO: remove/3.7.0-final
|
||||
if ShareType == "bday": # TODO: remove/3.7.0-final
|
||||
ShareType = "map" # TODO: remove/3.7.0-final
|
||||
Conversion = "bday" # TODO: remove/3.7.0-final
|
||||
|
||||
if not self.sharing_collection_by_map and not self.sharing_collection_by_token:
|
||||
if not action == 'info':
|
||||
# API is not enabled
|
||||
@@ -879,14 +864,6 @@ class BaseSharing:
|
||||
Conversion=Conversion,
|
||||
)
|
||||
|
||||
if "SHARING_NO_LEGACY" not in os.environ: # TODO: remove/3.7.0-final
|
||||
# check and change to legacy ShareType # TODO: remove/3.7.0-final
|
||||
result_array_adj = copy.deepcopy(result_array) # TODO: remove/3.7.0-final
|
||||
for index in range(0, len(result_array_adj)): # TODO: remove/3.7.0-final
|
||||
if result_array_adj[index]['Conversion'] == "bday": # TODO: remove/3.7.0-final
|
||||
result_array_adj[index]['ShareType'] = "bday" # TODO: remove/3.7.0-final
|
||||
result_array = result_array_adj
|
||||
|
||||
answer['Lines'] = len(result_array)
|
||||
if len(result_array) == 0:
|
||||
answer['Status'] = "not-found"
|
||||
@@ -1273,9 +1250,6 @@ class BaseSharing:
|
||||
if ShareType in ["all", "map"]:
|
||||
answer['FeatureEnabledCollectionByMap'] = self.sharing_collection_by_map
|
||||
answer['PermittedCreateCollectionByMap'] = self.permit_create_map
|
||||
if "SHARING_NO_LEGACY" not in os.environ: # TODO: remove/3.7.0-final
|
||||
answer['FeatureEnabledCollectionByBday'] = self.sharing_collection_by_map # TODO: remove/3.7.0-final
|
||||
answer['PermittedCreateCollectionByBday'] = self.permit_create_map # TODO: remove/3.7.0-final
|
||||
if ShareType in ["all", "token"]:
|
||||
answer['FeatureEnabledCollectionByToken'] = self.sharing_collection_by_token
|
||||
answer['PermittedCreateCollectionByToken'] = self.permit_create_token
|
||||
|
||||
@@ -4359,11 +4359,8 @@ permissions: RrWw""")
|
||||
assert answer_dict['Status'] == "success"
|
||||
assert answer_dict['Lines'] == 1
|
||||
row = answer_dict['Content'][0]
|
||||
if "SHARING_NO_LEGACY" not in os.environ: # TODO: remove/3.7.0-final
|
||||
assert row['ShareType'] == "bday" # TODO: remove/3.7.0-final
|
||||
else: # TODO: remove/3.7.0-final
|
||||
assert row['ShareType'] == "map"
|
||||
assert row['Conversion'] == "bday"
|
||||
assert row['ShareType'] == "map"
|
||||
assert row['Conversion'] == "bday"
|
||||
|
||||
# check PROPFIND item as user
|
||||
logging.info("\n*** PROPFIND item as user -> calendar")
|
||||
|
||||
@@ -183,8 +183,7 @@ export class CollectionsScene {
|
||||
let share_info = get_element(node, "[data-name=shared-by]");
|
||||
let transformed_from = get_element(node, "[data-name=transformed-from]");
|
||||
let share = (shares || []).find(
|
||||
// TODO: Eventually remove the check for "bday"
|
||||
s => (s.ShareType === "map" || s.ShareType === "bday") &&
|
||||
s => (s.ShareType === "map") &&
|
||||
(s.PathOrToken || "").replace(/\/+$/, "") === (collection.href || "").replace(/\/+$/, ""));
|
||||
if (share) {
|
||||
if (share.Owner !== user) {
|
||||
|
||||
@@ -99,8 +99,7 @@ export class IncomingSharingScene {
|
||||
|
||||
let prefix = "/" + user + "/";
|
||||
let filtered_shares = shares.filter(
|
||||
// TODO: Eventually remove bday
|
||||
share => (share.ShareType === "map" || share.ShareType === "bday")
|
||||
share => (share.ShareType === "map")
|
||||
&& share.PathOrToken.startsWith(prefix));
|
||||
|
||||
if (filtered_shares.length === 0) {
|
||||
|
||||
@@ -225,8 +225,7 @@ function add_share_rows(user, password, collection, shares, errorHandler) {
|
||||
if (share["ShareType"] === "token") {
|
||||
add_share_row_node(user, password, collection, share, token_template, "share", delete_share_by_token, errorHandler);
|
||||
}
|
||||
// TODO: Eventually remove bday
|
||||
else if (share["ShareType"] === "map" || share["ShareType"] === "bday") {
|
||||
else if (share["ShareType"] === "map") {
|
||||
add_share_row_node(user, password, collection, share, map_template, "map", delete_share_by_map, errorHandler);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user