ComponentAccessor.getProjectManager().getProjectObjects() is listing all project area although logged in user is member of only 1 project area. How to get list of project area for a logged in user based on his membership in project area.
Hello @Subhajit Bhuiya
You can do it with PermissionManager
Here is example that retrieves projects where user have Browse project permission
import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.permission.ProjectPermissionsdef permissionManager = ComponentAccessor.getPermissionManager()def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()def projects = permissionManager.getProjects(ProjectPermissions.BROWSE_PROJECTS, user)
Hello,
The problem is that ComponentAccessor.getProjectManager().getProjectObjects() does not check user permissions. You should first get all projects to which a user has permissions. For example, in the code of @Mark Markov you get all projects, for which the user has Browse issues permission.
Then you can already do required actions on the returned projects.
@Mark Markov Is there a way to use the same in confluence to get jira project for logged in user.
It looks like you're new here. Sign in or register to get started.