Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

getters.gno

3.13 Kb · 69 lines
 1package access
 2
 3import "gno.land/p/onbloc/access/manager"
 4
 5// HasRole returns role membership status for account.
 6// Union reference:
 7// https://github.com/unionlabs/union/blob/8cff0ff34f6baa4cdb1e4650a08985dd05de0c5a/cosmwasm/access-manager/src/contract.rs#L1172-L1197
 8func HasRole(role manager.RoleId, account address) manager.HasRoleResult {
 9	return accessState.HasRole(role, account)
10}
11
12// GetRoleAdmin returns the admin role configured for role.
13// Union reference:
14// https://github.com/unionlabs/union/blob/8cff0ff34f6baa4cdb1e4650a08985dd05de0c5a/cosmwasm/access-manager/src/contract.rs#L1119-L1126
15func GetRoleAdmin(role manager.RoleId) manager.RoleId {
16	return accessState.GetRoleAdmin(role)
17}
18
19// GetRoleGrantDelay returns the grant delay configured for role.
20// Union reference:
21// https://github.com/unionlabs/union/blob/8cff0ff34f6baa4cdb1e4650a08985dd05de0c5a/cosmwasm/access-manager/src/contract.rs#L1137-L1145
22func GetRoleGrantDelay(role manager.RoleId) manager.Delay {
23	return accessState.GetRoleGrantDelay(role)
24}
25
26// GetFunctionRole returns the selector role for targetPath.
27// Union reference:
28// https://github.com/unionlabs/union/blob/8cff0ff34f6baa4cdb1e4650a08985dd05de0c5a/cosmwasm/access-manager/src/contract.rs#L1091-L1107
29func GetFunctionRole(targetPath string, selector manager.Selector) manager.RoleId {
30	return GetTargetFunctionRole(targetPath, selector)
31}
32
33// GetTargetFunctionRole returns the selector role for targetPath.
34// Union reference:
35// https://github.com/unionlabs/union/blob/8cff0ff34f6baa4cdb1e4650a08985dd05de0c5a/cosmwasm/access-manager/src/contract.rs#L1091-L1107
36func GetTargetFunctionRole(targetPath string, selector manager.Selector) manager.RoleId {
37	return accessState.GetTargetFunctionRole(targetPath, selector)
38}
39
40// IsTargetClosed reports whether targetPath is closed.
41// Union reference:
42// https://github.com/unionlabs/union/blob/8cff0ff34f6baa4cdb1e4650a08985dd05de0c5a/cosmwasm/access-manager/src/contract.rs#L1082-L1089
43func IsTargetClosed(targetPath string) bool {
44	return accessState.IsTargetClosed(targetPath)
45}
46
47// CanCall reports whether caller can call selector on targetPath.
48// Union reference:
49// https://github.com/unionlabs/union/blob/8cff0ff34f6baa4cdb1e4650a08985dd05de0c5a/cosmwasm/access-manager/src/contract.rs#L1033-L1068
50func CanCall(targetPath string, selector manager.Selector, caller address) manager.CanCallResult {
51	return accessState.CanCall(caller, targetPath, selector)
52}
53
54// IsAuthorized reports immediate call authorization for targetPath.
55// Union reference:
56// https://github.com/unionlabs/union/blob/8cff0ff34f6baa4cdb1e4650a08985dd05de0c5a/cosmwasm/access-manager/src/contract.rs#L1033-L1068
57func IsAuthorized(targetPath string, selector manager.Selector, caller address) bool {
58	return accessState.IsAuthorized(caller, targetPath, selector)
59}
60
61// CanAdminRole reports whether caller can administer role.
62func CanAdminRole(role manager.RoleId, caller address) manager.CanCallResult {
63	return accessState.CanAdminRole(role, caller)
64}
65
66// CanManageTarget reports whether caller can manage target configuration.
67func CanManageTarget(caller address) manager.CanCallResult {
68	return accessState.CanManageTarget(caller)
69}