mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-04-27 11:56:05 +02:00
8c67d44aef
* refactor(store): more reworks * Enable auto save by default * Store to resource table by default * Remove share store * Clean up * Add close store * Add store function * Add lazy store * Add init to lazy store * refresh cache in example * Add get-or-create-store * Revert "Add get-or-create-store" This reverts commit7ffd769240. * try get first * Docs * Use absolute path for store * more docs * Allow js to use pre-stored (de)serialize functions * Fix js get and close store * Show case how to use pretty json * Update readme * Use store instead of `store_builder` in example * Build * Fix example * More docs for StoreBuilder::build * Add default (de)serialize fn * Use pretty json by default * Use `undefined` for empty value in get * Change files * Differentiate json null from no value for events * Add create or existing * Build * Rename inner store's inset method to set * Update readme * Apply suggestions from code review * Use close instead * Update breaking changes * Return result in resolve_store_path * Change to close_resource and take &self * Clean up * Apply suggestions from code review Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com> * Remove unused pub(crate) * Update change file * Expose resolve_store_path * Remove with_store * Remove StoreInner from pub and expose is_empty * Fix wrong jsdoc param * Update readme * rename createOrExistingStore to createOrLoad * make api consistent with the JS implementation, add examples * fmt * reintroduce "get existing store" behavior for create_or_load * rename createOrLoad to newOrExisting * keep store lock throughout whole new_or_existing_inner * Remove load * Missed if load * Don't make StoreState public * Remove R: Runtime from Builder * rename newOrExisting to load, load to reload * update docs * rename missing reload fn * rename builder fn to build() * fix default permission * Fix description and create_new logic * Clippy * Update docs * Update docs * remove create_store command * remove close_store command since we extend from Resource * Revert "remove close_store command since we extend from Resource" This reverts commit4a29fc8990. * Reapply "remove close_store command since we extend from Resource" This reverts commit70a1830e7d. --------- Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com> Co-authored-by: Lucas Nogueira <lucas@tauri.app>
445 lines
13 KiB
JSON
445 lines
13 KiB
JSON
{
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"title": "PermissionFile",
|
|
"description": "Permission file that can define a default permission, a set of permissions or a list of inlined permissions.",
|
|
"type": "object",
|
|
"properties": {
|
|
"default": {
|
|
"description": "The default permission set for the plugin",
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/DefaultPermission"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
},
|
|
"set": {
|
|
"description": "A list of permissions sets defined",
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/PermissionSet"
|
|
}
|
|
},
|
|
"permission": {
|
|
"description": "A list of inlined permissions",
|
|
"default": [],
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/Permission"
|
|
}
|
|
}
|
|
},
|
|
"definitions": {
|
|
"DefaultPermission": {
|
|
"description": "The default permission set of the plugin.\n\nWorks similarly to a permission with the \"default\" identifier.",
|
|
"type": "object",
|
|
"required": [
|
|
"permissions"
|
|
],
|
|
"properties": {
|
|
"version": {
|
|
"description": "The version of the permission.",
|
|
"type": [
|
|
"integer",
|
|
"null"
|
|
],
|
|
"format": "uint64",
|
|
"minimum": 1.0
|
|
},
|
|
"description": {
|
|
"description": "Human-readable description of what the permission does. Tauri convention is to use <h4> headings in markdown content for Tauri documentation generation purposes.",
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"permissions": {
|
|
"description": "All permissions this set contains.",
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"PermissionSet": {
|
|
"description": "A set of direct permissions grouped together under a new name.",
|
|
"type": "object",
|
|
"required": [
|
|
"description",
|
|
"identifier",
|
|
"permissions"
|
|
],
|
|
"properties": {
|
|
"identifier": {
|
|
"description": "A unique identifier for the permission.",
|
|
"type": "string"
|
|
},
|
|
"description": {
|
|
"description": "Human-readable description of what the permission does.",
|
|
"type": "string"
|
|
},
|
|
"permissions": {
|
|
"description": "All permissions this set contains.",
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/PermissionKind"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"Permission": {
|
|
"description": "Descriptions of explicit privileges of commands.\n\nIt can enable commands to be accessible in the frontend of the application.\n\nIf the scope is defined it can be used to fine grain control the access of individual or multiple commands.",
|
|
"type": "object",
|
|
"required": [
|
|
"identifier"
|
|
],
|
|
"properties": {
|
|
"version": {
|
|
"description": "The version of the permission.",
|
|
"type": [
|
|
"integer",
|
|
"null"
|
|
],
|
|
"format": "uint64",
|
|
"minimum": 1.0
|
|
},
|
|
"identifier": {
|
|
"description": "A unique identifier for the permission.",
|
|
"type": "string"
|
|
},
|
|
"description": {
|
|
"description": "Human-readable description of what the permission does. Tauri internal convention is to use <h4> headings in markdown content for Tauri documentation generation purposes.",
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"commands": {
|
|
"description": "Allowed or denied commands when using this permission.",
|
|
"default": {
|
|
"allow": [],
|
|
"deny": []
|
|
},
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/Commands"
|
|
}
|
|
]
|
|
},
|
|
"scope": {
|
|
"description": "Allowed or denied scoped when using this permission.",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/Scopes"
|
|
}
|
|
]
|
|
},
|
|
"platforms": {
|
|
"description": "Target platforms this permission applies. By default all platforms are affected by this permission.",
|
|
"type": [
|
|
"array",
|
|
"null"
|
|
],
|
|
"items": {
|
|
"$ref": "#/definitions/Target"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"Commands": {
|
|
"description": "Allowed and denied commands inside a permission.\n\nIf two commands clash inside of `allow` and `deny`, it should be denied by default.",
|
|
"type": "object",
|
|
"properties": {
|
|
"allow": {
|
|
"description": "Allowed command.",
|
|
"default": [],
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"deny": {
|
|
"description": "Denied command, which takes priority.",
|
|
"default": [],
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"Scopes": {
|
|
"description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```",
|
|
"type": "object",
|
|
"properties": {
|
|
"allow": {
|
|
"description": "Data that defines what is allowed by the scope.",
|
|
"type": [
|
|
"array",
|
|
"null"
|
|
],
|
|
"items": {
|
|
"$ref": "#/definitions/Value"
|
|
}
|
|
},
|
|
"deny": {
|
|
"description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.",
|
|
"type": [
|
|
"array",
|
|
"null"
|
|
],
|
|
"items": {
|
|
"$ref": "#/definitions/Value"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"Value": {
|
|
"description": "All supported ACL values.",
|
|
"anyOf": [
|
|
{
|
|
"description": "Represents a null JSON value.",
|
|
"type": "null"
|
|
},
|
|
{
|
|
"description": "Represents a [`bool`].",
|
|
"type": "boolean"
|
|
},
|
|
{
|
|
"description": "Represents a valid ACL [`Number`].",
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/Number"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"description": "Represents a [`String`].",
|
|
"type": "string"
|
|
},
|
|
{
|
|
"description": "Represents a list of other [`Value`]s.",
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/Value"
|
|
}
|
|
},
|
|
{
|
|
"description": "Represents a map of [`String`] keys to [`Value`]s.",
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"$ref": "#/definitions/Value"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"Number": {
|
|
"description": "A valid ACL number.",
|
|
"anyOf": [
|
|
{
|
|
"description": "Represents an [`i64`].",
|
|
"type": "integer",
|
|
"format": "int64"
|
|
},
|
|
{
|
|
"description": "Represents a [`f64`].",
|
|
"type": "number",
|
|
"format": "double"
|
|
}
|
|
]
|
|
},
|
|
"Target": {
|
|
"description": "Platform target.",
|
|
"oneOf": [
|
|
{
|
|
"description": "MacOS.",
|
|
"type": "string",
|
|
"enum": [
|
|
"macOS"
|
|
]
|
|
},
|
|
{
|
|
"description": "Windows.",
|
|
"type": "string",
|
|
"enum": [
|
|
"windows"
|
|
]
|
|
},
|
|
{
|
|
"description": "Linux.",
|
|
"type": "string",
|
|
"enum": [
|
|
"linux"
|
|
]
|
|
},
|
|
{
|
|
"description": "Android.",
|
|
"type": "string",
|
|
"enum": [
|
|
"android"
|
|
]
|
|
},
|
|
{
|
|
"description": "iOS.",
|
|
"type": "string",
|
|
"enum": [
|
|
"iOS"
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"PermissionKind": {
|
|
"type": "string",
|
|
"oneOf": [
|
|
{
|
|
"description": "Enables the clear command without any pre-configured scope.",
|
|
"type": "string",
|
|
"const": "allow-clear"
|
|
},
|
|
{
|
|
"description": "Denies the clear command without any pre-configured scope.",
|
|
"type": "string",
|
|
"const": "deny-clear"
|
|
},
|
|
{
|
|
"description": "Enables the delete command without any pre-configured scope.",
|
|
"type": "string",
|
|
"const": "allow-delete"
|
|
},
|
|
{
|
|
"description": "Denies the delete command without any pre-configured scope.",
|
|
"type": "string",
|
|
"const": "deny-delete"
|
|
},
|
|
{
|
|
"description": "Enables the entries command without any pre-configured scope.",
|
|
"type": "string",
|
|
"const": "allow-entries"
|
|
},
|
|
{
|
|
"description": "Denies the entries command without any pre-configured scope.",
|
|
"type": "string",
|
|
"const": "deny-entries"
|
|
},
|
|
{
|
|
"description": "Enables the get command without any pre-configured scope.",
|
|
"type": "string",
|
|
"const": "allow-get"
|
|
},
|
|
{
|
|
"description": "Denies the get command without any pre-configured scope.",
|
|
"type": "string",
|
|
"const": "deny-get"
|
|
},
|
|
{
|
|
"description": "Enables the get_store command without any pre-configured scope.",
|
|
"type": "string",
|
|
"const": "allow-get-store"
|
|
},
|
|
{
|
|
"description": "Denies the get_store command without any pre-configured scope.",
|
|
"type": "string",
|
|
"const": "deny-get-store"
|
|
},
|
|
{
|
|
"description": "Enables the has command without any pre-configured scope.",
|
|
"type": "string",
|
|
"const": "allow-has"
|
|
},
|
|
{
|
|
"description": "Denies the has command without any pre-configured scope.",
|
|
"type": "string",
|
|
"const": "deny-has"
|
|
},
|
|
{
|
|
"description": "Enables the keys command without any pre-configured scope.",
|
|
"type": "string",
|
|
"const": "allow-keys"
|
|
},
|
|
{
|
|
"description": "Denies the keys command without any pre-configured scope.",
|
|
"type": "string",
|
|
"const": "deny-keys"
|
|
},
|
|
{
|
|
"description": "Enables the length command without any pre-configured scope.",
|
|
"type": "string",
|
|
"const": "allow-length"
|
|
},
|
|
{
|
|
"description": "Denies the length command without any pre-configured scope.",
|
|
"type": "string",
|
|
"const": "deny-length"
|
|
},
|
|
{
|
|
"description": "Enables the load command without any pre-configured scope.",
|
|
"type": "string",
|
|
"const": "allow-load"
|
|
},
|
|
{
|
|
"description": "Denies the load command without any pre-configured scope.",
|
|
"type": "string",
|
|
"const": "deny-load"
|
|
},
|
|
{
|
|
"description": "Enables the reload command without any pre-configured scope.",
|
|
"type": "string",
|
|
"const": "allow-reload"
|
|
},
|
|
{
|
|
"description": "Denies the reload command without any pre-configured scope.",
|
|
"type": "string",
|
|
"const": "deny-reload"
|
|
},
|
|
{
|
|
"description": "Enables the reset command without any pre-configured scope.",
|
|
"type": "string",
|
|
"const": "allow-reset"
|
|
},
|
|
{
|
|
"description": "Denies the reset command without any pre-configured scope.",
|
|
"type": "string",
|
|
"const": "deny-reset"
|
|
},
|
|
{
|
|
"description": "Enables the save command without any pre-configured scope.",
|
|
"type": "string",
|
|
"const": "allow-save"
|
|
},
|
|
{
|
|
"description": "Denies the save command without any pre-configured scope.",
|
|
"type": "string",
|
|
"const": "deny-save"
|
|
},
|
|
{
|
|
"description": "Enables the set command without any pre-configured scope.",
|
|
"type": "string",
|
|
"const": "allow-set"
|
|
},
|
|
{
|
|
"description": "Denies the set command without any pre-configured scope.",
|
|
"type": "string",
|
|
"const": "deny-set"
|
|
},
|
|
{
|
|
"description": "Enables the values command without any pre-configured scope.",
|
|
"type": "string",
|
|
"const": "allow-values"
|
|
},
|
|
{
|
|
"description": "Denies the values command without any pre-configured scope.",
|
|
"type": "string",
|
|
"const": "deny-values"
|
|
},
|
|
{
|
|
"description": "This permission set configures what kind of\noperations are available from the store plugin.\n\n#### Granted Permissions\n\nAll operations are enabled by default.\n\n",
|
|
"type": "string",
|
|
"const": "default"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
} |