HEX
Server: Apache/2.4.63 (Unix)
System: Linux Synopilou92 4.4.302+ #72806 SMP Mon Jul 21 23:16:00 CST 2025 x86_64
User: pilou92 (1026)
PHP: 8.0.30
Disabled: NONE
Upload Files
File: /volume1/@appstore/SynologyPhotos/sdk-plugin/synology_foto_user_delete.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2000 - present Synology Inc. All rights reserved.

from os import environ
from importlib.util import spec_from_file_location, module_from_spec

module_name = "common"
module_path = "/var/packages/SynologyPhotos/target/sdk-plugin/common.py"
spec = spec_from_file_location(module_name, module_path)
common = module_from_spec(spec)
spec.loader.exec_module(common)


class UserDelete(common.PluginRunner):
    # @override
    def post(self):
        if "0" != environ.get("RESULT"):
            return None

        delete_uids: list[int] = []
        n_items = int(environ.get("NITEMS"))
        for i in range(1, n_items + 1):
            if environ.get(f"USER_OP_RESULT_{i}") == "0x0000":
                delete_uids.append(int(environ.get(f"UID_{i}")))

        self.send_command("user-delete", {"uid": delete_uids})


common.MainBody(UserDelete())