Search in sources :

Example 1 with PermissionModel

use of com.synopsys.integration.jira.common.model.response.PermissionModel in project hub-alert by blackducksoftware.

the class JiraCloudGlobalFieldModelTestAction method isUserAdmin.

@Override
protected boolean isUserAdmin(FieldUtility fieldUtility) throws IntegrationException {
    JiraCloudProperties jiraProperties = jiraCloudPropertiesFactory.createJiraProperties(fieldUtility);
    JiraCloudServiceFactory jiraCloudServiceFactory = jiraProperties.createJiraServicesCloudFactory(logger, gson);
    MyPermissionsService myPermissionsService = jiraCloudServiceFactory.createMyPermissionsService();
    MultiPermissionResponseModel myPermissions = myPermissionsService.getMyPermissions(JiraGlobalFieldModelTestAction.JIRA_ADMIN_PERMISSION_NAME);
    PermissionModel adminPermission = myPermissions.extractPermission(JiraGlobalFieldModelTestAction.JIRA_ADMIN_PERMISSION_NAME);
    return null != adminPermission && adminPermission.getHavePermission();
}
Also used : JiraCloudServiceFactory(com.synopsys.integration.jira.common.cloud.service.JiraCloudServiceFactory) PermissionModel(com.synopsys.integration.jira.common.model.response.PermissionModel) MultiPermissionResponseModel(com.synopsys.integration.jira.common.model.response.MultiPermissionResponseModel) JiraCloudProperties(com.synopsys.integration.alert.channel.jira.cloud.JiraCloudProperties) MyPermissionsService(com.synopsys.integration.jira.common.cloud.service.MyPermissionsService)

Example 2 with PermissionModel

use of com.synopsys.integration.jira.common.model.response.PermissionModel in project hub-alert by blackducksoftware.

the class JiraServerGlobalFieldModelTestAction method isUserAdmin.

@Override
protected boolean isUserAdmin(FieldUtility fieldUtility) throws IntegrationException {
    JiraServerProperties jiraProperties = createJiraProperties(fieldUtility);
    JiraServerServiceFactory jiraServerServiceFactory = jiraProperties.createJiraServicesServerFactory(logger, gson);
    MyPermissionsService myPermissionsService = jiraServerServiceFactory.createMyPermissionsService();
    MultiPermissionResponseModel myPermissions = myPermissionsService.getMyPermissions();
    PermissionModel adminPermission = myPermissions.extractPermission(JiraGlobalFieldModelTestAction.JIRA_ADMIN_PERMISSION_NAME);
    return null != adminPermission && adminPermission.getHavePermission();
}
Also used : JiraServerServiceFactory(com.synopsys.integration.jira.common.server.service.JiraServerServiceFactory) PermissionModel(com.synopsys.integration.jira.common.model.response.PermissionModel) MultiPermissionResponseModel(com.synopsys.integration.jira.common.model.response.MultiPermissionResponseModel) JiraServerProperties(com.synopsys.integration.alert.channel.jira.server.JiraServerProperties) MyPermissionsService(com.synopsys.integration.jira.common.server.service.MyPermissionsService)

Example 3 with PermissionModel

use of com.synopsys.integration.jira.common.model.response.PermissionModel in project hub-alert by blackducksoftware.

the class JiraServerGlobalTestActionWrapper method isUserAdmin.

public boolean isUserAdmin() throws IntegrationException {
    MyPermissionsService myPermissionsService = jiraServerServiceFactory.createMyPermissionsService();
    MultiPermissionResponseModel myPermissions = myPermissionsService.getMyPermissions();
    PermissionModel adminPermission = myPermissions.extractPermission(JiraServerGlobalTestAction.JIRA_ADMIN_PERMISSION_NAME);
    return null != adminPermission && adminPermission.getHavePermission();
}
Also used : PermissionModel(com.synopsys.integration.jira.common.model.response.PermissionModel) MultiPermissionResponseModel(com.synopsys.integration.jira.common.model.response.MultiPermissionResponseModel) MyPermissionsService(com.synopsys.integration.jira.common.server.service.MyPermissionsService)

Aggregations

MultiPermissionResponseModel (com.synopsys.integration.jira.common.model.response.MultiPermissionResponseModel)3 PermissionModel (com.synopsys.integration.jira.common.model.response.PermissionModel)3 MyPermissionsService (com.synopsys.integration.jira.common.server.service.MyPermissionsService)2 JiraCloudProperties (com.synopsys.integration.alert.channel.jira.cloud.JiraCloudProperties)1 JiraServerProperties (com.synopsys.integration.alert.channel.jira.server.JiraServerProperties)1 JiraCloudServiceFactory (com.synopsys.integration.jira.common.cloud.service.JiraCloudServiceFactory)1 MyPermissionsService (com.synopsys.integration.jira.common.cloud.service.MyPermissionsService)1 JiraServerServiceFactory (com.synopsys.integration.jira.common.server.service.JiraServerServiceFactory)1