diff --git a/README.md b/README.md index cd1ce8d..04ecbe5 100644 --- a/README.md +++ b/README.md @@ -266,6 +266,13 @@ This wrapper cover the following APIs for now: | SYNO.ActiveBackup.Version | | SYNO.ActiveBackup.Log | +| Core User | +|-------------------------------| +| SYNO.Core.User | +| SYNO.Core.User.Group | +| SYNO.Core.User.PasswordPolicy | +| SYNO.Core.User.PasswordExpiry | + | Snapshot Replication | |--------------------------| | SYNO.Core.Share.Snapshot | @@ -342,7 +349,6 @@ This wrapper cover the following APIs for now: | SYNO.SurveillanceStation.Face.Result | | SYNO.SurveillanceStation.Recording.Bookmark | - #### FileStation Functions list To explain the use of some function I will divide all the functions in two sets @@ -423,6 +429,7 @@ if you encounter problems you might set ```download_st_version = 2``` during ini | `resume_task()` | Resume a task. | | `edit_task()` | Edit a Task. | + #### Photo functions: | Function | |-------------------------------------| @@ -563,6 +570,9 @@ DS info with below functions: | `get_disk_utilization()` | | `get_memory_utilization()` | | `dsm_info()` | +| `get_system_health()` | +| `upgrade_status()` | +| `groups_info()` | ### core_group (DSM User Groups) | Functions | Description | @@ -581,6 +591,20 @@ DS info with below functions: | `create()` | Create new group | | `delete()` | Delete specified groups | +### core_user (DSM User Settings) +| Functions | Description | +|----------------------------|-----------------------------------------------------------------| +| `get_users()` | Retrieve groups information | +| `create_user()` | Create a new user | +| `modify_user()` | Modify a user | +| `delete_user()` | Delete a user | +| `affect_groups()` | Affect or disaffect groups to a user | +| `affect_groups_status()` | Get the status of a join task | +| `get_password_policy()` | Get the password policy | +| `set_password_policy()` | Set the password policy | +| `get_password_expiry()` | Get the password expiry | +| `set_password_expiry()` | Set the password expiry | + ### Virtualization | Functions | |----------------------------| diff --git a/synology_api/__init__.py b/synology_api/__init__.py index 3f3b08b..f402c30 100755 --- a/synology_api/__init__.py +++ b/synology_api/__init__.py @@ -10,6 +10,7 @@ core_backup, \ core_certificate, \ core_sys_info, \ + core_group, \ downloadstation, \ log_center, \ vpn, \ diff --git a/synology_api/core_sys_info.py b/synology_api/core_sys_info.py index d447eab..d6d584c 100644 --- a/synology_api/core_sys_info.py +++ b/synology_api/core_sys_info.py @@ -1,6 +1,9 @@ from __future__ import annotations from typing import Optional from . import base_api +from __future__ import annotations +from typing import Optional +from . import base_api class SysInfo(base_api.BaseApi): @@ -851,6 +854,22 @@ def server_pair(self) -> dict[str, object] | str: return self.request_data(api_name, api_path, req_param) + def groups_info(self, offset: int = 0, limit: int = -1, name_only: bool = False) -> dict[str, object] | str: + api_name = 'SYNO.Core.Group' + info = self.core_list[api_name] + api_path = info['path'] + + if name_only: + name_only = 'true' + elif not name_only: + name_only = 'false' + else: + return 'name_only must be True or False' + req_param = {'version': info['maxVersion'], 'method': 'list', 'offset': offset, 'limit': limit, + 'name_only': name_only, 'type': 'local'} + + return self.request_data(api_name, api_path, req_param) + def ldap_info(self) -> dict[str, object] | str: api_name = 'SYNO.Core.Directory.LDAP' info = self.core_list[api_name] @@ -1020,3 +1039,17 @@ def active_notifications(self) -> dict[str, object] | str: req_param = {'version': info['maxVersion'], 'method': 'notify', 'action': 'load'} return self.request_data(api_name, api_path, req_param) + + def get_system_health(self) -> dict[str, object] | str: + api_name = 'SYNO.Core.System.SystemHealth' + info = self.core_list[api_name] + api_path = info['path'] + req_param = {'version': info['maxVersion'], 'method': 'get'} + return self.request_data(api_name, api_path, req_param) + + def upgrade_status(self) -> dict[str, object] | str: + api_name = 'SYNO.Core.Upgrade' + info = self.core_list[api_name] + api_path = info['path'] + req_param = {'version': info['maxVersion'], 'method': 'status'} + return self.request_data(api_name, api_path, req_param)