Skip to main content

Group

Overview​

Core Group API implementation for Synology NAS.

This class provides methods to manage groups, including:

  • Retrieving group information, members, permissions, quotas, and speed limits.
  • Modifying group name, description, share permissions, quotas, and speed limits.
  • Creating and deleting groups.
  • Adding and removing users from groups.

Supported methods​

  • Getters :
    • Retrieve groups information.
    • Retrieve users who are members or not members of a group.
    • Retrieve bandwidth control settings for a group.
    • Retrieve quota settings for a group.
    • Retrieve share permissions for a group.
  • Setters :
    • Change group name and/or description.
    • Set group quota for a given share.
    • Set group permissions for a given share.
    • Set speed limit for a given share.
    • Add users to a group.
    • Remove users from a group.
    • Create a new group.
    • Delete specified groups.

Methods​

get_groups​

Retrieve groups information.

Internal API​

SYNO.Core.Group

Parameters​

offset int
The offset of the groups to retrieve. Defaults to 0.

limit int
The maximum number of groups to retrieve. Defaults to -1 (all groups).

name_only bool
If True, returns only group names. If False, returns full group information. Defaults to False.

Returns​

dict[str, object]
A dictionary containing the groups information.

Example return​

Click to expand
{
"data": {
"groups": [
{
"description": "System default admin group",
"gid": 101,
"name": "administrators"
},
{
"description": "System default group for Web services",
"gid": 1023,
"name": "http"
},
{
"description": "A test group",
"gid": 65536,
"name": "Test"
},
{
"description": "System default group",
"gid": 100,
"name": "users"
}
],
"offset": 0,
"total": 4
},
"success": true
}

get_users​

Retrieve users who are members or not members of a group.

Internal API​

SYNO.Core.Group.Member

Parameters​

group str
The group to list users from.

in_group bool
If True, retrieves users who are members of the specified group. If False, retrieves users who are not members of the group. Defaults to True.

Returns​

dict[str, object]
A dictionary containing the result of the request.

Example return​

Click to expand
{
"data": {
"offset": 0,
"total": 3,
"users": [
{
"description": "System default user",
"name": "admin",
"uid": 1024
},
{
"description": "",
"name": "customAdmin",
"uid": 1026
},
{
"description": "",
"name": "test",
"uid": 1032
}
]
},
"success": true
}

get_speed_limits​

Retrieve bandwidth control settings for a given group.

Internal API​

SYNO.Core.BandwidthControl

Parameters​

group str
The group to retrieve settings for.

Returns​

dict[str, object]
A dictionary containing the result of the request.

Example return​

Click to expand
{
"data": {
"bandwidths": [
{
"download_limit_1": 0,
"download_limit_2": 0,
"name": "group_name",
"owner_type": "local_group",
"policy": "notexist",
"protocol": "FTP",
"protocol_ui": "FTP",
"schedule_plan": "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111",
"upload_limit_1": 0,
"upload_limit_2": 0
},
]
},
"success": true
}

get_quota​

Retrieve quota settings for a given group.

Internal API​

SYNO.Core.Quota

Parameters​

group str
The group to retrieve quota settings for.

Returns​

dict[str, object]
A dictionary containing the result of the request.

Example return​

Click to expand
{
"data": {
"group_quota": [
{
"deduped": false,
"quota_status": "v1",
"shares": [
{
"description": "",
"name": "ActiveBackupforBusiness",
"quota": 1024
}
],
"support_share_quota": true,
"volume": "/volume3"
}
]
},
"success": true
}

get_permissions​

Retrieve share permissions for a given group.

Internal API​

SYNO.Core.Share.Permission

Parameters​

group str
The group to list permissions for.

Returns​

dict[str, object]
A dictionary containing the result of the request.

Example return​

Click to expand
{
"data": {
"shares": [
{
"is_aclmode": true,
"is_custom": false,
"is_deny": true,
"is_mask": false,
"is_readonly": false,
"is_sync_share": false,
"is_unite_permission": false,
"is_writable": false,
"name": "ActiveBackupforBusiness",
"share_path": "/volume3/ActiveBackupforBusiness"
}
],
"total": 1
},
"success": true
}

set_group_info​

Change group name and/or description.

Internal API​

SYNO.Core.Group

Parameters​

group str
The group to set information for.

new_name str
The new name of the group. Defaults to current value.

new_description str
The new description of the group. Defaults to current value.

Returns​

dict[str, object]
A dictionary containing the result of the request.

Example return​

Click to expand
{
"data": {
"gid": 65536,
"name": "Test_mod"
},
"success": true
}

set_share_quota​

Set group quota for a given share.

Internal API​

SYNO.Core.Quota

Parameters​

group str
The group to set the quota for.

share_quotas list of dict
The quotas to set for the group.

Returns​

dict[str, object]
A dictionary containing the result of the request.

Example return​

Click to expand
{
"data": {},
"success": true
}

set_share_permissions​

Set group permissions for a given share.

Internal API​

SYNO.Core.Share.Permission

Parameters​

group str
The group to set the permissions for.

permissions list of dict
The permissions to set for the group.

Returns​

dict[str, object]
A dictionary containing the result of the request.

Example return​

Click to expand
{
"success": true
}

set_speed_limit​

Set speed limit for a given share.

Internal API​

SYNO.Core.BandwidthControl

Parameters​

group str
The group to set the speed limit for.

upload_limit int
The maximum upload speed in KB/s.

download_limit int
The maximum download speed in KB/s.

protocol str
The protocol to set the speed limit for. Possible values: FileStation, WebDAV, FTP, NetworkBackup (Rsync), CloudStation (Synology Drive).

Returns​

dict[str, object]
A dictionary containing the result of the request.

Example return​

Click to expand
{
"data": {
"results": [
true
]
},
"success": true
}

add_users​

Add users to a group.

Internal API​

SYNO.Core.Group.Member

Parameters​

group str
The group to add users to.

users list of str
The users to add to the group.

Returns​

dict[str, object]
A dictionary containing the result of the request.

Example return​

Click to expand
{
"data": {},
"success": true
}

remove_users​

Remove users from a group.

Internal API​

SYNO.Core.Group.Member

Parameters​

group str
The group to remove users from.

users list of str
The users to remove from the group.

Returns​

dict[str, object]
A dictionary containing the result of the request.

Example return​

Click to expand
{
"data": {},
"success": true
}

create​

Create a new group.

Internal API​

SYNO.Core.Group

Parameters​

name str
Name to assign to the group.

description str
Description to assign to the group. Defaults to empty string.

Returns​

dict[str, object]
A dictionary containing the result of the request.

Example return​

Click to expand
{
"data": {
"gid": 65541,
"name": "new_group"
},
"success": true
}

delete​

Delete specified groups.

Internal API​

SYNO.Core.Group

Parameters​

groups list of str
The groups to delete.

Returns​

dict[str, object]
A dictionary containing the result of the request.

Example return​

Click to expand
{
"data": {},
"success": true
}