Quản lý lưu giữ

Lưu giữ dữ liệu vô thời hạn để đáp ứng các nghĩa vụ pháp lý hoặc lưu giữ. Thông thường, các yêu cầu lưu giữ dữ liệu được áp dụng cho một hoặc nhiều người dùng để đảm bảo rằng không thể xoá dữ liệu có thể liên quan đến một vấn đề cho đến khi vấn đề đó không còn hoạt động nữa.

Nếu một người dùng thuộc phạm vi yêu cầu lưu giữ dữ liệu bị lưu giữ, thì dữ liệu đó sẽ bị loại bỏ khỏi chế độ xem của người dùng nhưng được lưu giữ trong Vault. Miễn là lệnh tạm ngưng được áp dụng, quản trị viên Vault có thể tìm kiếm và xuất dữ liệu đó.

Yêu cầu lưu giữ dữ liệu có các thành phần sau:

  • Dịch vụ – ứng dụng chịu trách nhiệm về dữ liệu cần lưu giữ. Bạn có thể đặt dịch vụ thành thư, Drive hoặc Groups.
  • Phạm vi – các thực thể thuộc phạm vi của yêu cầu lưu giữ dữ liệu. Bạn có thể đặt phạm vi thành một hoặc nhiều tài khoản người dùng hoặc thành một đơn vị tổ chức (OU).
  • Tùy chọn bổ sung (không bắt buộc) – thông tin chi tiết cụ thể (cụm từ tìm kiếm hoặc lựa chọn về cấu hình) dùng để thu hẹp dữ liệu cần lưu giữ trong phạm vi đã xác định. Các tuỳ chọn bao gồm:
    • thư, Groups: cụm từ tìm kiếm để thu hẹp phạm vi lưu giữ
    • Drive: bao gồm bộ nhớ dùng chung trong yêu cầu lưu giữ dữ liệu

Để làm việc với các tài nguyên của Vault, tài khoản phải có các đặc quyền bắt buộc của Vault và quyền truy cập vào vấn đề. Để truy cập vào một vấn đề, tài khoản đó phải là người đã tạo vấn đề, đã chia sẻ vấn đề đó với họ hoặc có đặc quyền Xem tất cả vấn đề.

Tạo yêu cầu lưu giữ dữ liệu cho thư trên các tài khoản người dùng cụ thể bằng một cụm từ tìm kiếm

Ví dụ sau đây cho thấy cách tạo yêu cầu lưu giữ dữ liệu có tên "Yêu cầu lưu giữ dữ liệu tài khoản thư đầu tiên của tôi" cho:

  • Dịch vụ: thư
  • Thực thể: tài khoản người dùng "user1" và "user2"
  • Tuỳ chọn khác: cụm từ tìm kiếm "to:ceo@company.com"

Truy xuất mã tài khoản người dùng từ AdminSdk. Xin lưu ý rằng Giữ tài khoản có thể có mã tài khoản hoặc email. Nếu bạn cung cấp cả hai tuỳ chọn, thì email sẽ được sử dụng và mã tài khoản sẽ bị bỏ qua.

Java

HeldMailQuery mailQuery = new HeldMailQuery().setTerms("to:ceo@company.com");
List accounts = Lists.newArrayList();
accounts.add(new HeldAccount().setAccountId(user1accountId));
accounts.add(new HeldAccount().setEmail(user2Email));
Hold hold = new Hold()
    .setName("My First mail Accounts Hold")
    .setCorpus("MAIL");
    .setQuery(new CorpusQuery().setMailQuery(mailQuery))
    .setAccounts(accounts);
Hold createdHold = client.matters().holds().create(matterId, hold).execute();
  

Python

def create_hold_mail_accounts(service, matter_id, account_id):
    mail_query = {'terms': 'to:ceo@company.com'}
    accounts = [
        {'accountId': user1_account_id},
        {'email': user2_email}
    ]
    wanted_hold = {
        'name': 'My First mail Accounts Hold',
        'corpus': 'MAIL',
        'query': {
            'mailQuery': mail_query
        },
        'accounts': accounts
    }
    return service.matters().holds().create(
        matterId=matter_id, body=wanted_hold).execute()

Tạo yêu cầu lưu giữ dữ liệu cho Drive trong một đơn vị tổ chức và bao gồm nội dung của bộ nhớ dùng chung

Ví dụ sau đây cho thấy cách tạo yêu cầu lưu giữ dữ liệu có tên là "Yêu cầu lưu giữ dữ liệu đầu tiên của đơn vị tổ chức trên Drive của tôi" cho:

  • Dịch vụ: Drive
  • Thực thể: đơn vị tổ chức "Finance" (Mã đơn vị tổ chức được ghi trong orgUnitId)
  • Các lựa chọn khác: bao gồm các bộ nhớ dùng chung mà người dùng trong đơn vị tổ chức này là thành viên

Truy xuất mã đơn vị tổ chức từ AdminSdk.

Java

HeldOrgUnit orgUnit = new HeldOrgUnit().setOrgUnitId(orgUnitId);
// Include shared drives content.
HeldDriveQuery driveQuery = new HeldDriveQuery().setIncludeSharedDriveFiles(true);
// Create the hold.
Hold hold = new Hold()
    .setName("My First Drive OU Hold")
    .setCorpus("DRIVE")
    .setQuery(new CorpusQuery().setDriveQuery(driveQuery))
    .setOrgUnit(orgUnit);
Hold createdHold = client.matters().holds().create(matterId, hold).execute();
return createdHold;

Python

def create_hold_drive_org(service, matter_id, org_unit_id):
    drive_query = {'includeSharedDriveFiles': True}
    org_unit = {'orgUnitId': org_unit_id}
    wanted_hold = {
        'name': 'My First Drive OU Hold',
        'corpus': 'DRIVE',
        'orgUnit': org_unit,
        'query': {
            'driveQuery': drive_query
        }
    }
    return service.matters().holds().create(
        matterId=matter_id, body=wanted_hold).execute()

Tạo yêu cầu lưu giữ dữ liệu cho Groups trên những tài khoản nhóm cụ thể có phạm vi ngày

Ví dụ sau đây cho thấy cách tạo một yêu cầu lưu giữ dữ liệu có tên là "Yêu cầu lưu giữ dữ liệu trong nhóm đầu tiên của tôi" đối với:

  • Dịch vụ: Nhóm
  • Thực thể: tài khoản nhóm "group1" và "group2"
  • Tùy chọn bổ sung: chỉ giữ lại những tin nhắn có ngày gửi trong khoảng từ "startTime" đến "endTime"

Truy xuất mã tài khoản nhóm từ AdminSdk.

Java

String APRIL_2_2017_GMT = "2017-04-02T00:00:00Z"; // See below for format*.
 
List accounts = Lists.newArrayList();
accounts.add(new HeldAccount().setAccountId(accountId));
accounts.add(new HeldAccount().setAccountId(accountId2));
HeldGroupsQuery groupQuery = new HeldGroupsQuery();
// Restrict by sent date.
groupQuery.setStartTime(APRIL_2_2017_GMT);
groupQuery.setEndTime(APRIL_2_2017_GMT);
// create the hold
Hold hold = new Hold()
    .setName("My First Group Hold")
    .setCorpus("GROUPS")
    .setQuery(new CorpusQuery().setGroupsQuery(groupQuery));
    hold.setAccounts(accounts);
Hold createdHold = client.matters().holds().create(matterId, hold).execute();
 

Python

def create_hold_groups_date_range(service, matter_id, group_account_id):
    groups_query = {
        'startTime': '2017-04-02T00:00:00Z', # See below for format*
        'endTime': '2017-04-02T00:00:00Z'
    }
    accounts = [{'accountId': group_account_id}]
    wanted_hold = {
        'name': 'My First Group Hold',
        'corpus': 'GROUPS',
        'query': {
            'groupsQuery': groups_query
        },
        'accounts': accounts
    }
    return service.matters().holds().create(
        matterId=matter_id, body=wanted_hold).execute()
 
  • Định dạng dấu thời gian. Ngoài ra, thời gian bắt đầu/kết thúc được chuyển đổi sang GMT và làm tròn xuống ngày bắt đầu của ngày cụ thể.

Truy vấn và sửa đổi các yêu cầu lưu giữ dữ liệu hiện có

Ví dụ sau đây trình bày cách liệt kê tất cả các tài khoản có trong yêu cầu lưu giữ dữ liệu hiện có:

Java

client.matters().holds().accounts().list(matterId, holdId).execute().getAccounts();

Python

# If no accounts are on hold, ['accounts'] will raise an error.
def list_held_accounts(service, matter_id, hold_id):
    return service.matters().holds().accounts().list(
        matterId=matter_id, holdId=hold_id).execute()['accounts'] 

Ví dụ sau đây cho biết cách thêm một tài khoản vào và xoá một tài khoản khỏi lệnh tạm ngưng hiện có:

Java

// Add an account by id.
client
        .matters()
        .holds()
        .accounts()
        .create(matterId, holdId, new HeldAccount().setAccountId(accountId))
        .execute();
// Remove an account by id.
client.matters().holds().accounts().delete(matterId, holdId, accountId).execute();

String email = "email@email.com";
// Add an account by email.
client
        .matters()
        .holds()
        .accounts()
        .create(matterId, holdId, new HeldAccount().setEmail(email))
        .execute();

Python

 
def add_held_account(service, matter_id, hold_id, account_id):
    held_account = {'accountId': account_id}
    return service.matters().holds().accounts().create(
        matterId=matter_id, holdId=hold_id, body=held_account).execute()

def remove_held_account(service, matter_id, hold_id, account_id):
    return service.matters().holds().accounts().delete(
        matterId=matter_id, holdId=hold_id, accountId=account_id).execute()

def add_held_account(service, matter_id, hold_id, email):
    held_account = {'email': email}
    return service.matters().holds().accounts().create(
        matterId=matter_id, holdId=hold_id, body=held_account).execute()
 

Ví dụ sau đây cho thấy cách sửa đổi đơn vị tổ chức trong yêu cầu lưu giữ dữ liệu của đơn vị tổ chức hiện có:

Java

Hold hold = client.matters().holds().get(matterId, holdId).execute();
hold.getOrgUnit().setOrgUnitId(newOrgUnitId);
Hold modifiedHold = client.matters().holds().update(matterId, holdId, hold).execute();
return modifiedHold;
 

Python

def update_hold_ou(service, matter_id, hold_id, org_unit_id):
    current_hold = get_hold(matter_id, hold_id)
    current_hold['orgUnit'] = {'orgUnitId': org_unit_id}
    return service.matters().holds().update(
        matterId=matter_id, holdId=hold_id, body=current_hold).execute() 

Ví dụ sau đây trình bày cách liệt kê tất cả các yêu cầu lưu giữ dữ liệu cho một vấn đề:

Java

 
String matterId = "Matter Id";

// List all holds. List holdsList = client.matters().holds().list(matterId).execute().getHolds();

// Paginate on holds. ListHoldsResponse response = client .matters() .holds() .list(matterId) .setPageSize(10) .execute();

String nextPageToken = response.getNextPageToken(); if (nextPageToken != null) { client .matters() .holds() .list(matterId) .setPageSize(10) .setPageToken(nextPageToken) .execute(); }

Python

# This can paginate in the same manner as with matters.
def list_holds(service, matter_id):
    return service.matters().holds().list(matterId=matter_id).execute()