ResourceAccessService
@Service public class ResourceAccessService
io/agentscope/builder/web/share/ResourceAccessService.java:38–193资源访问服务,承载智能体的部署、调度与服务化运行。位于 io.agentscope.builder.web.share 包。核心成员包括 tierFor、can、require、listShares、share、unshare。
Generic owner-or-shared access control for non-agent managed resources (environments, memory
stores, vaults). Reuses AgentAclService.Tier so all ACL decisions in the app share the
same three-tier vocabulary (CLONE < RUN < EDIT), but keeps grants in a single
resource-type-keyed table (ResourceShareEntity) instead of one table per resource kind.
Rule: the resource owner always holds EDIT; any grant matching the caller (direct
USER grant or a WORKSPACE grant applying to every logged-in user) contributes
its tier, and the highest applicable tier wins.
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public ResourceAccessService(ResourceShareEntityRepository repository) | 初始化 `ResourceAccessService` 实例。 Creates a new instance. |
方法摘要Method Summary
构造器详情Constructor Detail
ResourceAccessService
public ResourceAccessService(ResourceShareEntityRepository repository)
初始化 ResourceAccessService 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
repository | ResourceShareEntityRepository | 仓库(类型 `ResourceShareEntityRepository`)。The repository. |
io/agentscope/builder/web/share/ResourceAccessService.java:43–45方法详情Method Detail
tierFor
public Tier tierFor(String userId, String ownerId, String resourceType, String resourceId)
执行 tierFor 方法。
Returns the highest tier userId holds on the resource, or null if none.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。The user id. |
ownerId | String | 所有者标识(类型 `String`)。The owner id. |
resourceType | String | 资源类型(类型 `String`)。The resource type. |
resourceId | String | 资源标识(类型 `String`)。The resource id. |
Tierio/agentscope/builder/web/share/ResourceAccessService.java:48–54can
public boolean can(String userId, String ownerId, String resourceType, String resourceId, Tier required)
执行可以相关操作。
true iff userId holds at least required on the resource.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。The user id. |
ownerId | String | 所有者标识(类型 `String`)。The owner id. |
resourceType | String | 资源类型(类型 `String`)。The resource type. |
resourceId | String | 资源标识(类型 `String`)。The resource id. |
required | Tier | 必填(类型 `Tier`)。The required. |
booleanio/agentscope/builder/web/share/ResourceAccessService.java:57–61require
public void require(String userId, String ownerId, String resourceType, String resourceId, Tier required)
执行 require 方法。
Verifies userId holds at least required on the resource.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
userId | String | 用户标识(类型 `String`)。The user id. |
ownerId | String | 所有者标识(类型 `String`)。The owner id. |
resourceType | String | 资源类型(类型 `String`)。The resource type. |
resourceId | String | 资源标识(类型 `String`)。The resource id. |
required | Tier | 必填(类型 `Tier`)。The required. |
ResponseStatusException可能抛出 `ResponseStatusException`。403 if the tier is insufficient
io/agentscope/builder/web/share/ResourceAccessService.java:68–75