Package io.meeds.mcp.server.tool
Class UserMcpTool
java.lang.Object
io.meeds.mcp.server.tool.UserMcpTool
- All Implemented Interfaces:
io.meeds.mcp.server.plugin.McpToolPlugin
@Service
public class UserMcpTool
extends Object
implements io.meeds.mcp.server.plugin.McpToolPlugin
-
Field Summary
Fields inherited from interface io.meeds.mcp.server.plugin.McpToolPlugin
DEFAULT_LIMIT, DEFAULT_OFFSET -
Constructor Summary
ConstructorsConstructorDescriptionUserMcpTool(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.profileproperty.ProfilePropertyService profilePropertyService, org.exoplatform.portal.config.UserACL userAcl, io.meeds.social.translation.service.TranslationService translationService, org.exoplatform.portal.config.UserPortalConfigService portalConfigService, org.exoplatform.social.core.manager.RelationshipManager relationshipManager, org.exoplatform.services.user.UserStateService userStateService) -
Method Summary
Modifier and TypeMethodDescriptionvoidacceptConnectionRequest(String username) Accepts the pending connection request sent by the given user to the current user.addWorkExperience(String company, String position, String skills, String startDate, String endDate, Boolean isCurrent, String description) Adds a work experience to the current user's profile.getConnectionStatus(String username) getUserByUsername(String username) getUserOnlineStatus(String username) longlistConnectionRequests(Integer offset, Integer limit) listConnectionSuggestions(Integer limit) listMyConnections(String query, Integer offset, Integer limit) listOnlineUsers(Integer offset, Integer limit) listSentConnectionRequests(Integer offset, Integer limit) listUserConnections(String username, Integer offset, Integer limit) voidrefuseConnectionRequest(String username) Refuses the pending connection request sent by the given user to the current user.voidremoveConnection(String username) removeWorkExperience(String experienceId) Removes a work experience from the current user's profile.searchUsers(String query, Integer offset, Integer limit) voidsendConnectionRequest(String username) setMyAvatar(String imageUrl, String imageBase64, String attachmentObjectType, String attachmentObjectId) Sets the current user's profile avatar from an image provided as exactly one of an http(s) URL, a base64 string, or an ACL-checked reference to a file already attached to a platform object.setMyBanner(String imageUrl, String imageBase64, String attachmentObjectType, String attachmentObjectId) Sets the current user's profile banner from an image provided as exactly one of an http(s) URL, a base64 string, or an ACL-checked reference to a readable platform attachment.setProfileFieldVisibility(String fieldName, Boolean hidden) Hides or shows one of the current user's profile fields.updateMyProfile(String aboutMe, String position, String company, String department, String team, String city, String country, String phones, String urls) Updates the given profile fields of the current user.updateWorkExperience(String experienceId, String company, String position, String skills, String startDate, String endDate, Boolean isCurrent, String description) Updates a work experience of the current user's profile.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.meeds.mcp.server.plugin.McpToolPlugin
getCurrentUserAclIdentity, getCurrentUserLocale, getCurrentUserLocale, getCurrentUserName, getLocale
-
Constructor Details
-
UserMcpTool
public UserMcpTool(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.profileproperty.ProfilePropertyService profilePropertyService, org.exoplatform.portal.config.UserACL userAcl, io.meeds.social.translation.service.TranslationService translationService, org.exoplatform.portal.config.UserPortalConfigService portalConfigService, org.exoplatform.social.core.manager.RelationshipManager relationshipManager, org.exoplatform.services.user.UserStateService userStateService)
-
-
Method Details
-
getMyUserInformation
-
getUserByUsername
-
searchUsers
-
getUsersCount
public long getUsersCount() -
setMyAvatar
public UserModel setMyAvatar(String imageUrl, String imageBase64, String attachmentObjectType, String attachmentObjectId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException Sets the current user's profile avatar from an image provided as exactly one of an http(s) URL, a base64 string, or an ACL-checked reference to a file already attached to a platform object. Acts as the current user, so the avatar always belongs to the caller. Refused with anIllegalAccessException, before the image is fetched, when the platform marks the avatar as not editable, unless the user is an administrator.- Returns:
- the updated user
- Throws:
IllegalAccessExceptionorg.exoplatform.commons.exception.ObjectNotFoundException
-
setMyBanner
public UserModel setMyBanner(String imageUrl, String imageBase64, String attachmentObjectType, String attachmentObjectId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException Sets the current user's profile banner from an image provided as exactly one of an http(s) URL, a base64 string, or an ACL-checked reference to a readable platform attachment. Acts as the current user. Refused with anIllegalAccessException, before the image is fetched, when the platform marks the banner as not editable, unless the user is an administrator.- Returns:
- the updated user
- Throws:
IllegalAccessExceptionorg.exoplatform.commons.exception.ObjectNotFoundException
-
listConnectionRequests
-
listSentConnectionRequests
-
listMyConnections
-
listUserConnections
-
getConnectionStatus
-
listConnectionSuggestions
-
sendConnectionRequest
-
acceptConnectionRequest
Accepts the pending connection request sent by the given user to the current user.- Parameters:
username- the user who sent the request
-
refuseConnectionRequest
Refuses the pending connection request sent by the given user to the current user.- Parameters:
username- the user who sent the request
-
removeConnection
-
updateMyProfile
public UserModel updateMyProfile(String aboutMe, String position, String company, String department, String team, String city, String country, String phones, String urls) Updates the given profile fields of the current user. A field the platform marks as not editable can only be changed by an administrator: for any other user, a value given for it is refused with anIllegalAccessException, before any field is written.- Returns:
- the updated user
-
addWorkExperience
public List<ExperienceModel> addWorkExperience(String company, String position, String skills, String startDate, String endDate, Boolean isCurrent, String description) Adds a work experience to the current user's profile. Refused with anIllegalAccessExceptionwhen the platform marks the experiences as not editable, unless the user is an administrator.- Returns:
- the experiences of the current user after the change
-
updateWorkExperience
public List<ExperienceModel> updateWorkExperience(String experienceId, String company, String position, String skills, String startDate, String endDate, Boolean isCurrent, String description) throws org.exoplatform.commons.exception.ObjectNotFoundException Updates a work experience of the current user's profile. Refused with anIllegalAccessExceptionwhen the platform marks the experiences as not editable, unless the user is an administrator.- Returns:
- the experiences of the current user after the change
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException
-
removeWorkExperience
public List<ExperienceModel> removeWorkExperience(String experienceId) throws org.exoplatform.commons.exception.ObjectNotFoundException Removes a work experience from the current user's profile. Refused with anIllegalAccessExceptionwhen the platform marks the experiences as not editable, unless the user is an administrator.- Returns:
- the experiences of the current user after the change
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException
-
setProfileFieldVisibility
Hides or shows one of the current user's profile fields. A field the platform marks as not editable is refused to a non-administrator, as Social's visibility endpoint refuses it before toggling.- Parameters:
fieldName- the fieldhidden- true to hide it, false or null to show it- Returns:
- the user's field visibility after the change
-
getProfileFieldVisibility
-
getUserOnlineStatus
-
listOnlineUsers
-