Is there any REST API or Java API through which I can get a user's security schemes or security levels? I want to know to what security level or security scheme the user is added.
I'm afrtaid this is not available.
Users can be member of a security scheme via a user group, project role or by being added as individual users.
There is no API endpoint that will show you where a user has been added based on those 3 possibilities or even based on individual users only.
You will have to use several REST APIs yourself to build this logic via scripting. https://docs.atlassian.com/software/jira/docs/api/REST/9.3.0/#api/2/permissionscheme
@Charlie Misonne thanks for the reply. Is there any Java API that can achieve the same? Through this, I can make a custom Jira plugin and can create an endpoint, and use that one to pass some kind of query parameter and get the user's issue security level or scheme.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, the javadoc is quite complete.
You will need the PermissionSchemeService and loop over all schemes with the getPermissionSchemes() method.
For each permission scheme you can do getPermission() and then get the PermissionGrant objects which has as getHolder() method containing the user, group or role
I haven't tested this but I'm quite sure you should be able to achieve your goal this way.
Security schemes are separate, you will find similar APIs for that via PermissionSchemeService.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Charlie Misonne Thank you so much for the reply. Actually, I was looking through the java documentation of Jira and found a better way to achieve that by using the getAllSecurityLevelsForUser() method in the 'com.atlassian.jira.issue.security' package and accepts the user as the parameter for which one wants to keep a check of the accessible security levels.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok that's good to know!
But it won't work for the permission schemes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Charlie Misonne yeah, you're right! Actually, I changed my approach from issue security scheme to issue security level for the task that I'm doing. So, this will work in my case.
But, I have one query. Is there any rest API or some java API to get the issue security scheme on a single issue? And, eventually, I can fetch the security levels inside that issue scheme.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The Issue object has a getSecurityLevelId() method https://docs.atlassian.com/software/jira/docs/api/9.3.0/index.html?com/atlassian/jira/issue/Issue.html
You can't get the scheme directly from the issue. You will have to get the scheme from the project via the IssueSecuritySchemeService: https://docs.atlassian.com/software/jira/docs/api/9.3.0/index.html?com/atlassian/jira/issue/security/IssueSecuritySchemeService.html
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.