如何使用 angular 执行 crud 操作来 lock/unlock 文件?
How to lock/unlock files from performing crud operations using angular?
基本上,我有一个从 blob 存储中获取的文件列表,用户可以在其上执行 crud。我想设置特定文件或文件夹的权限,以便其他用户不会意外删除或修改 files/folder。如何使用 angular 实现它?或 Azure Blob 存储?我们如何知道文件是否正在被使用?或者用户必须手动锁定文件,以便其他用户无法修改它们?
I'd like to set the permission to particular files or folder so that
other user cannot accidentally delete or modify the files/folder. How
can I achieve it using angular? or azure blob storage?
您当然可以通过获取 blob 租约来锁定 Azure Blob 存储中的文件。在 blob 上获得租约后,只要 blob 处于租用状态,就不能删除或修改 blob,除非请求包含租约 ID。但是锁定与设置权限不同。您可以在此处了解有关 blob 租赁的更多信息:https://docs.microsoft.com/en-us/rest/api/storageservices/lease-blob.
如果可以选择使用文件存储(而不是 Blob 存储),那么它会提供更好的功能。本质上,您可以做的是在文件或文件夹上设置属性,然后将其设置为只读。只要 file/folder 是只读的,就不能对该文件进行任何更改。设置文件属性是通过更改文件的属性来完成的。您可以在此处了解有关设置文件属性的更多信息:https://docs.microsoft.com/en-us/rest/api/storageservices/set-file-properties(在此页面上搜索 x-ms-file-attributes
)。
基本上,我有一个从 blob 存储中获取的文件列表,用户可以在其上执行 crud。我想设置特定文件或文件夹的权限,以便其他用户不会意外删除或修改 files/folder。如何使用 angular 实现它?或 Azure Blob 存储?我们如何知道文件是否正在被使用?或者用户必须手动锁定文件,以便其他用户无法修改它们?
I'd like to set the permission to particular files or folder so that other user cannot accidentally delete or modify the files/folder. How can I achieve it using angular? or azure blob storage?
您当然可以通过获取 blob 租约来锁定 Azure Blob 存储中的文件。在 blob 上获得租约后,只要 blob 处于租用状态,就不能删除或修改 blob,除非请求包含租约 ID。但是锁定与设置权限不同。您可以在此处了解有关 blob 租赁的更多信息:https://docs.microsoft.com/en-us/rest/api/storageservices/lease-blob.
如果可以选择使用文件存储(而不是 Blob 存储),那么它会提供更好的功能。本质上,您可以做的是在文件或文件夹上设置属性,然后将其设置为只读。只要 file/folder 是只读的,就不能对该文件进行任何更改。设置文件属性是通过更改文件的属性来完成的。您可以在此处了解有关设置文件属性的更多信息:https://docs.microsoft.com/en-us/rest/api/storageservices/set-file-properties(在此页面上搜索 x-ms-file-attributes
)。