Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dynamic acl related support #18

Closed
Tracked by #227
lurenpluto opened this issue Apr 24, 2023 · 6 comments
Closed
Tracked by #227

Add dynamic acl related support #18

lurenpluto opened this issue Apr 24, 2023 · 6 comments
Assignees
Labels
feature New feature

Comments

@lurenpluto
Copy link
Member

We need to add support for the ts-sdk side of this feature buckyos/CYFS#175, mainly including changes related to the cyfs-lib side, involving the following.

  • Router Handler's acl request and response
  • AclAction related definitions
  • rmeta's access new Handler type
@lurenpluto lurenpluto added the feature New feature label Apr 24, 2023
weiqiushi added a commit that referenced this issue Apr 26, 2023
@weiqiushi
Copy link
Member

@lizhihongTest

@lizhihongTest
Copy link

Why cyfs-ts-sdk cyfs.GlobalStatePathAccessItem constructor function can`t set parameter? And cyfs.AccessString not contain Handler type. Currently constructing GlobalStatePathGroupAccess::Handler access is very unfriendly

  • cyfs-rust-sdk
let item = GlobalStatePathAccessItem {
  path: TEST_REQ_PATH.to_owned(),
  access: GlobalStatePathGroupAccess::Handler,
};
  • cyfs-ts-sdk
let item1 : cyfs.GlobalStatePathAccessItem = cyfs.GlobalStatePathAccessItem.new("QATest",cyfs.AccessString.full());
item1.access = cyfs.GlobalStatePathGroupAccess.Handler();
let item2 : cyfs.GlobalStatePathAccessItem = new cyfs.GlobalStatePathAccessItem();
item2.access = cyfs.GlobalStatePathGroupAccess.Handler();
item2.path = "QATest";

@lizhihongTest
Copy link

lizhihongTest commented Apr 27, 2023

@weiqiushi You set cyfs.GlobalStatePathAccessItem constructor private ,If use cyfs-ts-sdk source code ,I can use private constructor ,But if compile code as cyfs_node it will missing private function

private constructor(path: string, access: GlobalStatePathGroupAccess) {

@weiqiushi
Copy link
Member

weiqiushi commented Apr 27, 2023

@weiqiushi You set cyfs.GlobalStatePathAccessItem constructor private ,If use cyfs-ts-sdk source code ,I can use private constructor ,But if compile code as cyfs_node it will missing private function

private constructor(path: string, access: GlobalStatePathGroupAccess) {

Yes. Unlike the rust language, there is no struct in typescript, only use class to approximate the GlobalStatePathAccessItem struct.

And because class must have a constructor, in order to simulate the behavior of new() and new_group() in rust, a private constructor is used, and the public static functions new() and new_group() are used to construct the GlobalStatePathAccessItem.

In fact, in the rust code, if you construct the GlobalStatePathAccessItem using only new() and new_group(), the written code will be the same as the ts version

@lizhihongTest
Copy link

When emit acl handler,It will maybe throw error "convert base58 str failed, str=undefined, Expected String"

Details

[debug],[2023-04-27 17:20:24.658],<>,will emit handler: full_id=acl_acl_smoke-test-dynamic-token, param={"request":{"dec_id":"9tGpLNndR5tyui8DkYBpEz8mFHzjfqkCVmsFusa5roHd","permissions":"r--","req_path":"/QATest","req_query_string":"token=QATest-token","source":{"dec":"9tGpLNndR5tyui8DkYBpEz8mFHzjfqkCVmsFusa5roHd","protocol":"http-bdt","zone":{"device":"5aSixgMHNaHEBwwhu8VhSCSgynDSzzhSmEbh59DgZRsN","zone":"5r4MYfFQWVzRG9i88MgDEbmRtsdugbsCU81LmFE5cWGF","zone_category":"other-zone"}}}}, cyfs_node.js:85892
[error],[2023-04-27 17:20:24.659],<>,convert base58 str failed, str=undefined, Expected String, cyfs_node.js:35424
[error],[2023-04-27 17:20:25.217],<>,Trace: [trace],[2023-04-27 17:20:24.660],<>,convert base58 str failed, str=undefined, Expected String, cyfs_node.js:35425
at BLogConsoleTarget.output (E:\githubSpace\cyfs-test-lab\src\cyfs-test-dec-app\node_modules\cyfs-sdk-nightly\index.js:94068:13)
at E:\githubSpace\cyfs-test-lab\src\cyfs-test-dec-app\node_modules\cyfs-sdk-nightly\index.js:96145:20
at Array.forEach ()
at BLog.log (E:\githubSpace\cyfs-test-lab\src\cyfs-test-dec-app\node_modules\cyfs-sdk-nightly\index.js:96144:17)
at console.trace (E:\githubSpace\cyfs-test-lab\src\cyfs-test-dec-app\cyfs\webpack:\cyfs-sdk\src\sdk\cyfs-debug\blog\node_blog.js:2265:1)
at from_base_x (E:\githubSpace\cyfs-test-lab\src\cyfs-test-dec-app\cyfs\webpack:\cyfs-sdk\src\sdk\cyfs-base\base\basex.ts:42:16)
at Object.from_base_58 (E:\githubSpace\cyfs-test-lab\src\cyfs-test-dec-app\cyfs\webpack:\cyfs-sdk\src\sdk\cyfs-base\base\basex.ts:48:2)
at Function.from_base_58 (E:\githubSpace\cyfs-test-lab\src\cyfs-test-dec-app\cyfs\webpack:\cyfs-sdk\src\sdk\cyfs-base\objects\object_id.ts:209:20)
at AclHandlerRequestJsonCodec.decode_object (E:\githubSpace\cyfs-test-lab\src\cyfs-test-dec-app\cyfs\webpack:\cyfs-sdk\src\sdk\cyfs-lib\acl\request.ts:34:25)
at RouterHandlerRequestJsonCodec.decode_object (E:\githubSpace\cyfs-test-lab\src\cyfs-test-dec-app\cyfs\webpack:\cyfs-sdk\src\sdk\cyfs-lib\router_handler\request.ts:117:26)
at RouterHandlerRequestJsonCodec.decode_string (E:\githubSpace\cyfs-test-lab\src\cyfs-test-dec-app\cyfs\webpack:\cyfs-sdk\src\sdk\cyfs-lib\base\codec.ts:31:6)
at RouterHandlerEventRoutineT.emit (E:\githubSpace\cyfs-test-lab\src\cyfs-test-dec-app\cyfs\webpack:\cyfs-sdk\src\sdk\cyfs-lib\router_handler\handler.ts:51:26)
at RouterHandlerItem.emit (E:\githubSpace\cyfs-test-lab\src\cyfs-test-dec-app\cyfs\webpack:\cyfs-sdk\src\sdk\cyfs-lib\router_handler\ws\handler.ts:48:10) at Function.on_event (E:\githubSpace\cyfs-test-lab\src\cyfs-test-dec-app\cyfs\webpack:\cyfs-sdk\src\sdk\c......
[debug],[2023-04-27 17:20:25.222],<>,ws process packet complete: sid=12, cmd=13, seq=1, cyfs_node.js:88475

@lizhihongTest
Copy link

This feature has test finished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
Status: Done
Development

No branches or pull requests

3 participants