Authing DocsDocuments
Concept
workflow
Guides
Development Integration
Application integration
Concept
workflow
Guides
Development Integration
Application integration
Old Version
Development Integration
  • Single Sign-On (SSO)
  • Login component

  • JavaScript/Node.js

  • Java / Kotlin

  • Python

    • User Authentication Module

    • Management Module

      • Manage resources and permissions
      • Management application
      • Management groups
      • Management organization
      • Management strategy
      • Management subject certification
      • Management role
      • Management log statistics
      • Management User Custom Fields
      • Management user pool configuration
      • Management user
      • Management registration white list
  • C#

  • PHP

  • Go

  • Ruby
  • Android

  • iOS

  • Flutter

  • React Native
  • WeChat Mini Program
  • WeChat webpage authorization
  • Framework Integration
  • Error code
  1. Development Integration
  2. /
  3. Python
  4. /
  5. Management Module
  6. /
  7. Management groups

¶ Manage grouping

Update Time: 2025-06-11 08:01:00
Edit

This module is used to manage Authing groups, which can be packetized, grouping / deleting users, gaining all resources such as packets authorized.

from authing.v2.management import ManagementClient, ManagementClientOptions

management_client = ManagementClient(
  options=ManagementClientOptions(
    user_pool_id='AUTHING_USERPOOL_ID',
    secret='AUTHING_USERPOOL_SECRET',
))

management_client.groups.list # Get a list of groups
management_client.groups.create # Create grouping
management_client.groups.list_users # Get a list of group users

¶ Create grouping

def create(self, code, name, description=None):
  pass

Creating a grouping, a packet must contain a user pool globally unique logo (Code), which must be a legitimate English flag, such as developers; and group name.

¶ parameter

  • code <str> Group unique marker
  • name <str> Group Name
  • description <str> description

¶ Example

management_client.groups.create(
  code='group',
  name='Group xxx'
)

¶ return value

{
  "code": "developers",
  "name": "开发者",
  "description": null,
  "createdAt": "2021-05-06T15:36:33+08:00",
  "updatedAt": "2021-05-06T15:36:33+08:00"
}

¶ Modify group

def update(self, code, new_code=None, name=None, description=None):
  pass

Modify the packet, a group in the unique flag user pool through the Code. You can modify this group's Code.

¶ parameter

  • code <str> Group unique marker
  • new_code <str> Packet new code
  • name <str> New name
  • description <str> New description information

¶ Example

management_client.groups.update(
  code='code1',
  new_code='code2'
)

¶ return value

Return new group details:

{
  "code": "new-code",
  "name": "Developer",
  "description": null,
  "createdAt": "2021-05-06T15:36:33+08:00",
  "updatedAt": "2021-05-06T15:36:33+08:00"
}

¶ Get a group details

def detail(self, code):
  pass

Get a grouped details, a group in the code unique logo user pool.

¶ parameter

  • code <str> Group unique marker

¶ Example

management_client.groups.detail('manager')

¶ return value

{
  "code": "developers",
  "name": "开发者",
  "description": null,
  "createdAt": "2021-05-06T15:36:33+08:00",
  "updatedAt": "2021-05-06T15:36:33+08:00"
}

¶ Get a list of groups

def list(self, page=1, limit=10):
  pass

Get a list of groups, this interface is a paging interface.

¶ parameter

  • page <int> The number of page numbers is: 1.
  • limit <int> The number of defaults per page is: 10.

¶ Example

management_client.groups.list(1, 10)

¶ return value

{
  "totalCount": 2,
  "list": [
    {
      "code": "code1",
      "name": "名称1",
      "description": null,
      "createdAt": "2021-05-06T15:36:33+08:00",
      "updatedAt": "2021-05-06T15:36:33+08:00"
    },
    {
      "code": "code2",
      "name": "名称2",
      "description": null,
      "createdAt": "2021-05-06T15:36:33+08:00",
      "updatedAt": "2021-05-06T15:36:33+08:00"
    }
  ]
}

¶ Delete group

def delete(self, code):
  pass

Delete the packet, a group in the unique flag user pool through the Code.

¶ parameter

  • code <str> Group unique marker

¶ Example

management_client.groups.delete('code')

¶ return value

{
  "code": 200,
  "massage": "Delete the group success"
}

¶ Batch delete group

def delete_many(self, code_list):
  pass

Remove the packet by grouping code batch.

¶ parameter

  • code_list <str[]> Group unique logo list.

¶ Example

management_client.groups.delete_many(['groupa', 'groupb'])

¶ return value

{
  "code": 200,
  "massage": "Delete the group success"
}

¶ Get a list of group users

def list_users(self, code, page=1, limit=10, with_custom_data=True):
  pass

Get the list of users. This interface is a paging interface.

¶ parameter

  • code <str> Group unique marker
  • page <int> The number of page numbers is: 1.
  • limit <int> The number of defaults per page is: 10.
  • with_custom_data: <bool> Whether to get custom data, default is false; if set to true, all custom data of the user will be returned in the customdata field. Example:
{
  "id": "604a12a261a85949c8ad0259",
  "customData": {
    "school": "清华大学",
    "age": 19
  }
}

¶ Example

  • Get grouping "group1" users (pagination)
management_client.groups.list_users('group1')
  • Get the user list while getting user custom data
management_client.groups.list_users('group1', with_custom_data=True)

¶ return value

{
  "totalCount": 2,
  "list": [
    {
      "customData": {
        "school": "清华大学",
        "age": 19
      }
    },
    {
      "customData": {
        "school": "清华大学",
        "age": 19
      }
    }
  ]
}

¶ Add user

def add_users(self, code, user_ids):
  pass

Group add users.

¶ parameter

  • code <str> Group unique marker
  • user_ids <str[]> User ID list

¶ Example

management_client.groups.add_users(code, ['USERID1', 'USERID2'])

¶ return value

{
  "code": 200,
  "massage": "Add user success"
}

¶ Removal user

def remove_users(self, code, user_ids):
  pass

Packet removal user.

¶ parameter

  • code <str> Group unique marker
  • user_ids <str[]> User ID list

¶ Example

management_client.groups.remove_users(code, ['USERID1', 'USERID2'])

¶ return value

{
  "code": 200,
  "massage": "Remove user success"
}

¶ Get list of all resources to be authorized

def list_authorized_resources(self, code, namespace, resource_type=None):
  pass

Get all the resources that are authorized.

¶ parameter

  • code <str> Group code;
  • namespace <str> Permission group code, please see Use Right Limits Group Management Rights Resources;
  • resourceType <str> Optional, resource type, default will return all permissions, existing resource types are as follows:
    • DATA: type of data;
    • API: API Type data;
    • MENU: Menu type data;
    • BUTTON: Button type data.

¶ Example

management_client.groups.list_authorized_resources('GROUP_CODE', 'default')

¶ Example Data

  • type For resource types;
  • code: Resource descriptor, if it is DATA type resource, format is resourceType:resourceId, such as books:* Represents all books, books:1 Indicates a book for ID 1.
  • actions: The user is authorized to operate the resource.
{
  "totalCount": 12,
  "list": [
    {
      "code": "menu_a",
      "type": "MENU"
    },
    {
      "code": "menu_b",
      "type": "MENU"
    },
    {
      "code": "books:1",
      "type": "DATA",
      "actions": ["books:delete", "books:update"]
    }
  ]
}
Prev: Management application Next: Management organization
  • Create grouping
  • Modify group
  • Get a group details
  • Get a list of groups
  • Delete group
  • Batch delete group
  • Get a list of group users
  • Add user
  • Removal user
  • Get list of all resources to be authorized

User identity management

Integrated third-party login
Mobile phone number flash check (opens new window)
Universal login form component
Custom authentication process

Enterprise internal management

Single Sign On
Multi-factor Authentication
Authority Management

Developers

Development Document
Framework Integration
Blog (opens new window)
GitHub (opens new window)
Community User Center (opens new window)

Company

400 888 2106
sales@authing.cn
16 / F, Block B, NORTH STAR CENTURY CENTER, Beijing(Total)
room 406, 4th floor, zone B, building 1, No. 200, Tianfu Fifth Street, Chengdu(branch)

Beijing ICP No.19051205-1

© Beijing Steamory Technology Co.