Data Share

Description

This worker creates shared folder and set its permission during package startup. The share name can be hard-coded in the specification or given by user input from the UI wizard. The shared folder will not be removed after package uninstallation, since it might delete the user’s personal data as well.

  • Acquire(): Create shared folder and set its permission.
    • If the shared folder already exists, skip share creation and set the permission.
  • Release(): Does nothing.

Provider

DSM

Timing

FROM_ENABLE_TO_POSTUNINST

Environment Variables

None

Updatable

No

Syntax

"data-share": {
  "shares": [{
    "name": "<share-name>",
    "permission": {
      "ro": ["<user-name>", ...],
      "rw": ["<user-name>", ...]
    },
    "once": "<once>"
  }, ...]
}
Member Since Description
shares 6.0-5914 Object array, array of shares to create
name 6.0-5914 String, name of the share, can be obtained from the UI wizard
permission 6.0-5914 Json object, permission of the share. (optional)
ro 6.0-5914 String array,users to be assigned with read-only permission.
rw 6.0-5914 String array,users to be assigned with read / write permission.
once 6.0-5914 Boolean, only try to create share on package's first start. (optional, default = false)

Example

The following specification creates a share music, and gives the user AudioStation read-only permission. Since once defaults to false, the above procedure is ran every time the package starts.

"data-share": {
  "shares": [{
    "name": "music",
    "permission": {
      "ro": ["AudioStation"]
    }
  }]
}

The following specification reads the share name from WIZARD_UIFILES/install_uifile's pkgwizard_share_name, and gives the user admin read-only permission.

"data-share": {
  "shares": [{
    "name": "{{pkgwizard_share_name}}",
    "permission": {
      "ro": ["admin"]
    }
  }]
}