return new ExecutionResult(context, false, "Invalid component.");
// "*" is the wildcard owner, so always allow this
// Otherwise, check for a match on owner
// Finally, check if there is Group ownership of this component
User user = PlatformAccess.getPlatform().getCurrentUser();
String owner = component.getOwner();
if (!owner.equals("*") && !owner.equals(user.getUserId()) && !RoleAccess.hasRole(user, owner)) {
Group group = component.getCapability(Group.class); // Check for group ownership
String groupId = group != null ? group.getDiscipline() : null;
if (groupId == null || !groupId.equals(PlatformAccess.getPlatform().getCurrentUser().getDisciplineId())) {
return new ExecutionResult(context, false, "User does not own this component.");
}