Help Center> Object Storage Service> Permissions Configuration Guide> Best Practices for Enterprise Data Access Control> Authorizing Business Departments with Independent Resource Permissions

Authorizing Business Departments with Independent Resource Permissions

A company usually consists of multiple business departments, and each department requires independent data management. In this scenario, you can allocate IAM users of different roles to each department, and configure bucket policies to authorize the IAM users with independent resource permissions.

Scenario Assumption

Assume that a company has two business departments: A and B. Each department needs a separate bucket to store data, and users of each department have the permission to upload data to their own department's bucket.

Figure 1 shows the logical relationships among administrators, users, and buckets between the two departments.

Figure 1 Logical relationship

This example describes how to configure the upload permission for users of a department. You can configure other permissions based on the site requirements. For details about bucket policy permissions, see Bucket Policy.

Solution and Process

The administrators of department A and department B can configure bucket policies to allow only users of their own department to upload data to their own department's bucket. For details about the configuration process, see Figure 2.

Figure 2 Permission control process

Prerequisites

You have an enterprise account of the company.

Procedure

  1. Create an administrator for each department and create users.

    You need to use the enterprise account of the company to create IAM users as administrators and common users. A department administrator can also create common users. In this example, each department has an administrator and several users.

    Add the administrator to the admin user group, which has the permissions to create users and buckets and configure bucket policies. Other users only need the permission to list buckets under the account but not permissions to create users or buckets or configure bucket policies. Therefore, add other users to user groups with the OBS Buckets Viewer permissions. For details about permissions, see Permissions Management.

    1. Create a department administrator and some IAM users. For details, see Creating an IAM User.
    2. Add the administrator to the admin user group, and add other users to user groups with the OBS Buckets Viewer permissions. For details, see Assigning Permissions to an IAM User.

  2. Create a bucket.

    The administrator of department A creates a bucket for its own department, so does the administrator of department B.

    1. Log in to OBS Console as the administrators of the two departments in sequence.
    2. On the console homepage, choose Service List > Storage > Object Storage Service to access OBS Console.
    3. In the navigation pane, choose Buckets. On the page that is displayed, click Create Bucket in the upper right corner.
    4. Select a region, storage class, and bucket policy, and then enter the bucket name.

      To ensure data security, set Bucket Policy to Private and set other parameters as prompted.

    5. Click Create Now. The bucket is created.

  3. Authorize users with the upload permission.

    The two administrators configure the upload permission for their own department users in their own bucket separately.

    1. Log in to OBS Console as the administrators of the two departments in sequence.
    2. On the console homepage, choose Service List > Storage > Object Storage Service to access OBS Console.
    3. In the navigation pane, choose Buckets. In the bucket list, click the department's bucket to go to the bucket overview page.
    4. In the navigation pane on the left, choose Permissions > Bucket Policy.
    5. Click Create Bucket Policy.
    6. In the first row of the bucket policy template, click Create Custom Policy.
    7. Set the following parameters to grant users in the department the permissions to access the bucket (list objects) and upload objects.
      Table 1 Parameters for granting permissions to access buckets and upload objects

      Parameter

      Description

      Policy View

      Select Visual editor.

      Policy Name

      Custom

      Policy Content

      Effect

      Select Allow.

      Principal

      • Principal: Current account
      • Sub-user: Select the users who are allowed to upload data in the department.
      • User Policy: Include specified users.

      Resources

      • Resource: Select Current bucket and Object in bucket.
        • If the data can be uploaded to any folder in the bucket, select All objects under Object in bucket.
        • If you want to upload the data only to one or more folders in the bucket, select Specified objects under Object in bucket, and, under Resource path, enter the folder path and put a wild character at its end (for example, example-folder/*). You can configure multiple resource paths.
      • Resource Policy: Include specified resources.

      Actions

      • Select ListBucket and PutObject.
      • Operation Strategy: Include selected actions.
    8. Click Next in the lower right corner.
    9. Click Create.

  4. Verify the permission.

    After the permission is configured, users of department A and department B can verify the permissions by uploading objects through OBS Console, OBS Browser+, APIs, and SDKs.

    The permission verification should focus on the following aspects (taking department A for an example):

    1. Users of department A can successfully upload objects to the bucket of department A.

      If users are allowed to upload objects to only the specified folder, ensure that:

      1. Objects can be successfully uploaded to the specified folder.
      2. Upload of objects to folders other than the specified one will fail.
    2. Users of department A fail to upload objects to the bucket of department B.
    3. Users of department A fail to download or delete any object from the bucket of department A.
    4. Users of department A fail to download or delete any object from the bucket of department B.

    If the preceding requirements are met, the permission configuration is successful.

Department Administrator Permission Control

After the preceding configuration, all department administrators have full permissions for buckets of other departments. If you want to deny other department administrators' access to bucket resources of your department, configure a bucket policy according to the following procedure:

  1. Log in to the HUAWEI CLOUD management console as an administrator of your department.
  2. On the console homepage, choose Service List > Storage > Object Storage Service to access OBS Console.
  3. In the navigation pane, choose Buckets. In the bucket list, click the department's bucket to go to the bucket overview page.
  4. In the navigation pane on the left, choose Permissions > Bucket Policy.
  5. Click Create Bucket Policy.
  6. In the first row of the bucket policy template, click Create Custom Policy.
  7. Set the following parameters to prevent administrators of other departments from accessing the bucket of the department.

    Table 2 Parameters for denying other department administrators' access to the bucket of the current department

    Parameter

    Description

    Policy View

    Select Visual editor.

    Policy Name

    Custom

    Policy Content

    Effect

    Select Deny.

    Principal

    • Principal: Current account
    • Sub-user: Select the administrators of other departments.
    • User Policy: Include specified users.

    Resources

    • Resource: Select Current bucket and Object in bucket and then select All objects under Object in bucket.
    • Resource Policy: Include specified resources.

    Actions

    • Select * (indicating all actions).
    • Operation Strategy: Include selected actions.

  8. Click Next in the lower right corner.
  9. Click Create.