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.ComponentAccessor
import com.atlassian.jira.permission.ProjectPermissions
def permissionManager = ComponentAccessor.getPermissionManager()
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def projects = permissionManager.getProjects(ProjectPermissions.BROWSE_PROJECTS, user)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.