From b42334195cd396a32e2181a805d5317f1b9b793f Mon Sep 17 00:00:00 2001 From: Sergey Motornyuk Date: Tue, 12 Mar 2024 19:40:33 +0200 Subject: [PATCH] chore: update auth --- ckanext/files/assets/scripts/files--queue.js | 6 +- ckanext/files/assets/ts/files--queue.ts | 4 +- ckanext/files/logic/action.py | 23 ++++--- ckanext/files/logic/auth.py | 40 ++++++++--- ckanext/files/logic/schema.py | 3 +- ckanext/files/storage/google_cloud.py | 10 ++- .../templates/files/snippets/file_table.html | 12 +++- .../{uploader.html => uploader_v1.html} | 15 ++--- .../templates/files/{ => user}/delete.html | 0 .../files/{user.html => user/index.html} | 7 +- ckanext/files/views.py | 66 ++++++++++++------- 11 files changed, 120 insertions(+), 66 deletions(-) rename ckanext/files/templates/files/snippets/{uploader.html => uploader_v1.html} (86%) rename ckanext/files/templates/files/{ => user}/delete.html (100%) rename ckanext/files/templates/files/{user.html => user/index.html} (85%) diff --git a/ckanext/files/assets/scripts/files--queue.js b/ckanext/files/assets/scripts/files--queue.js index 98b9975..8e8b799 100644 --- a/ckanext/files/assets/scripts/files--queue.js +++ b/ckanext/files/assets/scripts/files--queue.js @@ -98,7 +98,7 @@ ckan.module("files--queue", function ($) { widget .find("[data-upload-progress]") .removeClass("bg-primary bg-secondary") - .addClass("bg-success progress-bar-succes"); + .addClass("bg-success progress-bar-success"); this.sandbox.publish(ckan.CKANEXT_FILES.topics.queueItemUploaded, file, result); }); this.setWidgetName(widget, info.file.name); @@ -120,7 +120,7 @@ ckan.module("files--queue", function ($) { toggleAnimation(widget, state) { widget .find("[data-upload-progress]") - .toggleClass("progress-bar-animated", state); + .toggleClass("progress-bar-animated active", state); }, _onWidgetResume(event) { const info = this.widgets.get(event.delegateTarget); @@ -153,4 +153,4 @@ ckan.module("files--queue", function ($) { }, }; }); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmlsZXMtLXF1ZXVlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdX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mRlbGVnYXRlVGFyZ2V0KTtcbiAgICAgIHdpZGdldFxuICAgICAgICAuZmluZChcIltkYXRhLXVwbG9hZC1wcm9ncmVzc11cIilcbiAgICAgICAgLnJlbW92ZUNsYXNzKFwiYmctc2Vjb25kYXJ5XCIpXG4gICAgICAgIC5hZGRDbGFzcyhcImJnLXByaW1hcnlcIik7XG5cbiAgICAgIGlmIChpbmZvLmlkKSB7XG4gICAgICAgIGluZm8udXBsb2FkZXIucmVzdW1lKGluZm8uZmlsZSwgaW5mby5pZCk7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBpbmZvLnVwbG9hZGVyLnVwbG9hZChpbmZvLmZpbGUpO1xuICAgICAgfVxuXG4gICAgICB0aGlzLnRvZ2dsZUFuaW1hdGlvbih3aWRnZXQsIHRydWUpO1xuICAgIH0sXG5cbiAgICBfb25XaWRnZXRQYXVzZShldmVudDogSlF1ZXJ5LlRyaWdnZXJlZEV2ZW50KSB7XG4gICAgICBjb25zdCBpbmZvID0gdGhpcy53aWRnZXRzLmdldChldmVudC5kZWxlZ2F0ZVRhcmdldCk7XG4gICAgICBpZiAoaW5mby51cGxvYWRlZCA+PSBpbmZvLnRvdGFsKSByZXR1cm47XG5cbiAgICAgIGNvbnN0IHdpZGdldCA9ICQoZXZlbnQuZGVsZWdhdGVUYXJnZXQpO1xuICAgICAgd2lkZ2V0XG4gICAgICAgIC5maW5kKFwiW2RhdGEtdXBsb2FkLXByb2dyZXNzXVwiKVxuICAgICAgICAucmVtb3ZlQ2xhc3MoXCJiZy1wcmltYXJ5XCIpXG4gICAgICAgIC5hZGRDbGFzcyhcImJnLXNlY29uZGFyeVwiKTtcblxuICAgICAgaW5mby51cGxvYWRlci5wYXVzZShpbmZvLmZpbGUpO1xuICAgICAgdGhpcy50b2dnbGVBbmltYXRpb24od2lkZ2V0LCBmYWxzZSk7XG4gICAgfSxcbiAgfTtcbn0pO1xuIl19 \ No newline at end of file +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW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ICB9LFxuICB9O1xufSk7XG4iXX0= \ No newline at end of file diff --git a/ckanext/files/assets/ts/files--queue.ts b/ckanext/files/assets/ts/files--queue.ts index 0cfaa85..2d9c34f 100644 --- a/ckanext/files/assets/ts/files--queue.ts +++ b/ckanext/files/assets/ts/files--queue.ts @@ -168,7 +168,7 @@ ckan.module("files--queue", function ($) { widget .find("[data-upload-progress]") .removeClass("bg-primary bg-secondary") - .addClass("bg-success progress-bar-succes"); + .addClass("bg-success progress-bar-success"); this.sandbox.publish( ckan.CKANEXT_FILES.topics.queueItemUploaded, file, @@ -200,7 +200,7 @@ ckan.module("files--queue", function ($) { toggleAnimation(widget: JQuery, state: boolean) { widget .find("[data-upload-progress]") - .toggleClass("progress-bar-animated", state); + .toggleClass("progress-bar-animated active", state); }, _onWidgetResume(event: JQuery.TriggeredEvent) { diff --git a/ckanext/files/logic/action.py b/ckanext/files/logic/action.py index 3c3994c..84e4650 100644 --- a/ckanext/files/logic/action.py +++ b/ckanext/files/logic/action.py @@ -30,18 +30,22 @@ def files_file_search_by_user(context, data_dict): tk.check_access("files_file_search_by_user", context, data_dict) sess = context["session"] + user = model.User.get(data_dict.get("user", context["user"])) + if not user: + raise tk.ObjectNotFound("user") + + q = sess.query(File).join( Owner, sa.and_(File.id == Owner.item_id, Owner.item_type == "file"), # type: ignore ) - user = model.User.get(data_dict.get("user", context["user"])) - if not user: - raise tk.ObjectNotFound("user") - + if "storage" in data_dict: + q = q.filter(File.storage == data_dict["storage"]) q = q.filter(sa.and_(Owner.owner_type == "user", Owner.owner_id == user.id)) + total = q.count() parts = data_dict["sort"].split(".") @@ -182,15 +186,10 @@ def files_file_show(context, data_dict): tk.check_access("files_file_show", context, data_dict) data_dict["id"] - fileobj = context["session"].query(File).filter_by(id=data_dict["id"]).one_or_none() + fileobj = context["session"].query(File).filter(File.id==data_dict["id"]).one_or_none() if not fileobj: raise tk.ObjectNotFound("file") - if context.get("update_access_time"): - fileobj.access() - if not context.get("defer_commit"): - context["session"].commit() - return fileobj.dictize(context) @@ -255,7 +254,7 @@ def files_upload_update(context, data_dict): extras = data_dict.get("__extras", {}) - fileobj = context["session"].get(File, data_dict["id"]) + fileobj = context["session"].query(File).filter_by(id=data_dict["id"]).one_or_none() if not fileobj: raise tk.ObjectNotFound("upload") @@ -276,7 +275,7 @@ def files_upload_complete(context, data_dict): extras = data_dict.get("__extras", {}) data_dict["id"] - fileobj = context["session"].get(File, data_dict["id"]) + fileobj = context["session"].query(File).filter_by(id=data_dict["id"]).one_or_none() if not fileobj: raise tk.ObjectNotFound("upload") diff --git a/ckanext/files/logic/auth.py b/ckanext/files/logic/auth.py index 5deec1b..35fa469 100644 --- a/ckanext/files/logic/auth.py +++ b/ckanext/files/logic/auth.py @@ -43,15 +43,30 @@ def _is_owner(user_id, file_id): @auth +@tk.auth_disallow_anonymous_access def files_manage_files(context, data_dict): # type: (types.Any, dict[str, types.Any]) -> types.Any return {"success": False} +@auth +@tk.auth_disallow_anonymous_access +def files_owns_file(context, data_dict): + # type: (types.Any, dict[str, types.Any]) -> types.Any + user = _get_user(context) + is_owner = bool(user and _is_owner(user.id, data_dict["id"])) + + return {"success": is_owner, "msg": "Not an owner of the file"} + + @auth @tk.auth_disallow_anonymous_access def files_file_search_by_user(context, data_dict): # type: (types.Any, dict[str, types.Any]) -> types.Any + """Only user himself can view his own files.""" + + # `user` from context will be used used when it's not in data_dict, so it's + # an access to own files if "user" not in data_dict: return {"success": True} @@ -64,46 +79,51 @@ def files_file_search_by_user(context, data_dict): @auth +@tk.auth_disallow_anonymous_access def files_file_create(context, data_dict): # type: (types.Any, dict[str, types.Any]) -> types.Any - return authz.is_authorized("files_manage_files", context, data_dict) + return {"success": True} @auth @tk.auth_disallow_anonymous_access def files_file_delete(context, data_dict): # type: (types.Any, dict[str, types.Any]) -> types.Any - user = _get_user(context) - is_owner = bool(user and _is_owner(user.id, data_dict["id"])) - - return {"success": is_owner, "msg": "Not authorized to remove the file"} + """Only owner can remove files.""" + return authz.is_authorized("files_owns_file", context, data_dict) @auth +@tk.auth_disallow_anonymous_access def files_file_show(context, data_dict): # type: (types.Any, dict[str, types.Any]) -> types.Any - return authz.is_authorized("files_manage_files", context, data_dict) + """Only owner can view files.""" + return authz.is_authorized("files_owns_file", context, data_dict) @auth +@tk.auth_disallow_anonymous_access def files_upload_show(context, data_dict): # type: (types.Any, dict[str, types.Any]) -> types.Any - return authz.is_authorized("files_manage_files", context, data_dict) + return authz.is_authorized("files_owns_file", context, data_dict) @auth +@tk.auth_disallow_anonymous_access def files_upload_initialize(context, data_dict): # type: (types.Any, dict[str, types.Any]) -> types.Any - return authz.is_authorized("files_manage_files", context, data_dict) + return authz.is_authorized("files_file_create", context, data_dict) @auth +@tk.auth_disallow_anonymous_access def files_upload_update(context, data_dict): # type: (types.Any, dict[str, types.Any]) -> types.Any - return authz.is_authorized("files_manage_files", context, data_dict) + return authz.is_authorized("files_owns_file", context, data_dict) @auth +@tk.auth_disallow_anonymous_access def files_upload_complete(context, data_dict): # type: (types.Any, dict[str, types.Any]) -> types.Any - return authz.is_authorized("files_manage_files", context, data_dict) + return authz.is_authorized("files_owns_file", context, data_dict) diff --git a/ckanext/files/logic/schema.py b/ckanext/files/logic/schema.py index 20c0129..4bb07af 100644 --- a/ckanext/files/logic/schema.py +++ b/ckanext/files/logic/schema.py @@ -18,7 +18,7 @@ def file_create(ignore_empty, unicode_safe, default, files_into_upload, not_miss @validator_args -def _base_file_search(unicode_safe, default, int_validator, boolean_validator, one_of): +def _base_file_search(unicode_safe, default, int_validator, boolean_validator, ignore_empty): # type: (types.Any, types.Any, types.Any, types.Any, types.Any) -> types.Any return { @@ -26,6 +26,7 @@ def _base_file_search(unicode_safe, default, int_validator, boolean_validator, o "rows": [default(10), int_validator], "sort": [default("name"), unicode_safe], "reverse": [boolean_validator], + "storage": [ignore_empty, unicode_safe], } diff --git a/ckanext/files/storage/google_cloud.py b/ckanext/files/storage/google_cloud.py index 86302f4..487e613 100644 --- a/ckanext/files/storage/google_cloud.py +++ b/ckanext/files/storage/google_cloud.py @@ -21,6 +21,12 @@ class GCStorageData(GCAdditionalData, types.MinimalStorageData): RE_RANGE = re.compile(r"bytes=(?P\d+)-(?P\d+)") +def decode(value): + # type: (bytes) -> str + if six.PY3: + return base64.decodebytes(value).hex() + + return base64.decodestring(value).encode("hex") class GoogleCloudUploader(Uploader): storage = None # type: GoogleCloudStorage # pyright: ignore @@ -39,7 +45,7 @@ def upload(self, name, upload, extras): client = self.storage.client blob = client.bucket(self.storage.settings["bucket"]).blob(filepath) blob.upload_from_file(upload.stream) - filehash = base64.decodebytes(blob.md5_hash.encode()).hex() + filehash = decode(blob.md5_hash.encode()) return { "filename": filename, "content_type": upload.content_type, @@ -222,7 +228,7 @@ def complete_multipart_upload(self, upload_data, extras): }, ) - filehash = base64.decodebytes(upload_data["result"]["md5Hash"].encode()).hex() + filehash = decode(upload_data["result"]["md5Hash"].encode()) return { "filename": os.path.relpath( diff --git a/ckanext/files/templates/files/snippets/file_table.html b/ckanext/files/templates/files/snippets/file_table.html index 46292c8..ab0371a 100644 --- a/ckanext/files/templates/files/snippets/file_table.html +++ b/ckanext/files/templates/files/snippets/file_table.html @@ -76,9 +76,10 @@ {% block file_actions %} {% if owner_type == "user" and owner_id and h.check_access("files_file_delete", {"id": file.id})%} - {% set delete_extras = {"user_id": owner_id} %} + href="{{ h.url_for('files.delete_file', + file_id=file.id, + came_from=request.path, user_id=owner_id) }}"> {% endif %} @@ -86,7 +87,12 @@ {% if not file.completed and h.check_access("files_upload_update", {"id": file.id})%}