|
30 | 30 | import java.util.Map; |
31 | 31 | import java.util.Objects; |
32 | 32 | import java.util.Optional; |
| 33 | +import java.util.Set; |
33 | 34 | import java.util.stream.Collectors; |
34 | 35 |
|
35 | 36 | /** |
@@ -149,11 +150,14 @@ public SkillDetailDTO getSkillDetail( |
149 | 150 | String skillSlug, |
150 | 151 | String currentUserId, |
151 | 152 | Map<Long, NamespaceRole> userNsRoles) { |
152 | | - |
153 | 153 | Namespace namespace = findNamespace(namespaceSlug); |
154 | 154 | Skill skill = resolveVisibleSkill(namespace.getId(), skillSlug, currentUserId); |
155 | 155 |
|
156 | | - // Visibility check |
| 156 | + if (namespace.getStatus() == com.iflytek.skillhub.domain.namespace.NamespaceStatus.ARCHIVED |
| 157 | + && !isNamespaceMember(namespace.getId(), currentUserId, userNsRoles)) { |
| 158 | + throw new DomainForbiddenException("error.namespace.archived", namespaceSlug); |
| 159 | + } |
| 160 | + |
157 | 161 | if (!visibilityChecker.canAccess(skill, currentUserId, userNsRoles)) { |
158 | 162 | throw new DomainForbiddenException("error.skill.access.denied", skillSlug); |
159 | 163 | } |
@@ -198,6 +202,15 @@ public SkillDetailDTO getSkillDetail( |
198 | 202 | ); |
199 | 203 | } |
200 | 204 |
|
| 205 | + public SkillDetailDTO getSkillDetail( |
| 206 | + String namespaceSlug, |
| 207 | + String skillSlug, |
| 208 | + String currentUserId, |
| 209 | + Map<Long, NamespaceRole> userNsRoles, |
| 210 | + Set<String> platformRoles) { |
| 211 | + return getSkillDetail(namespaceSlug, skillSlug, currentUserId, userNsRoles); |
| 212 | + } |
| 213 | + |
201 | 214 | /** |
202 | 215 | * Lists skills within a namespace after filtering out records the caller is |
203 | 216 | * not allowed to discover. |
|
0 commit comments