Issue #535: User is not able to claim ownership of the Topics and das… (#536)

* Issue #535: User is not able to claim ownership of the Topics and dashboards entity.
This commit is contained in:
Sriharsha Chintalapani 2021-09-20 16:01:24 -07:00 committed by GitHub
parent 740dfa11c4
commit 7f10cfb22b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 2 deletions

View File

@ -207,6 +207,11 @@ public abstract class DashboardRepository {
relationshipDAO().deleteAll(id);
}
@Transaction
public EntityReference getOwnerReference(Dashboard dashboard) throws IOException {
return EntityUtil.populateOwner(userDAO(), teamDAO(), dashboard.getOwner());
}
public static List<EntityReference> toEntityReference(List<Chart> charts) {
List<EntityReference> refList = new ArrayList<>();
for (Chart chart: charts) {

View File

@ -185,6 +185,11 @@ public abstract class TopicRepository {
return updated;
}
@Transaction
public EntityReference getOwnerReference(Topic topic) throws IOException {
return EntityUtil.populateOwner(userDAO(), teamDAO(), topic.getOwner());
}
public Topic createInternal(Topic topic, EntityReference service, EntityReference owner) throws IOException {
topic.setFullyQualifiedName(getFQN(service, topic));
EntityUtil.populateOwner(userDAO(), teamDAO(), owner); // Validate owner

View File

@ -255,7 +255,7 @@ public class DashboardResource {
Fields fields = new Fields(FIELD_LIST, FIELDS);
Dashboard dashboard = dao.get(id, fields);
SecurityUtil.checkAdminRoleOrPermissions(authorizer, securityContext,
EntityUtil.getEntityReference(dashboard));
dao.getOwnerReference(dashboard));
dashboard = dao.patch(id, patch);
return addHref(uriInfo, dashboard);
}

View File

@ -254,7 +254,7 @@ public class TopicResource {
Fields fields = new Fields(FIELD_LIST, FIELDS);
Topic topic = dao.get(id, fields);
SecurityUtil.checkAdminRoleOrPermissions(authorizer, securityContext,
EntityUtil.getEntityReference(topic));
dao.getOwnerReference(topic));
topic = dao.patch(id, patch);
return addHref(uriInfo, topic);
}