本文整理汇总了Java中com.atlassian.crowd.embedded.api.User类的典型用法代码示例。如果您正苦于以下问题:Java User类的具体用法?Java User怎么用?Java User使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
User类属于com.atlassian.crowd.embedded.api包,在下文中一共展示了User类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getContextMap
import com.atlassian.crowd.embedded.api.User; //导入依赖的package包/类
public Map getContextMap(User user, JiraHelper jiraHelper) {
Map contextMap = jiraHelper.getContextParams();
Issue issue = (Issue) contextMap.get("issue");
ExternalObject exObj = this.jamClient.getExternalObject(issue);
contextMap.put("name", exObj.Name);
contextMap.put("exidHtml", exObj.Exid);
contextMap.put("objectTypeHtml", exObj.ObjectType);
contextMap.put("linkHtml", exObj.ODataLink);
contextMap.put("metadataHtml", exObj.ODataMetadata);
contextMap.put("permalinkHtml", exObj.Permalink);
contextMap.put("annotationsHtml", exObj.ODataAnnotations);
contextMap.put("loginToken", jamClient.getSingleUseToken());
contextMap.put("jamUrl", jamClient.getJamUrl());
return contextMap;
}
开发者ID:SAP,项目名称:SAPJamWorkPatternJIRAIntegration,代码行数:22,代码来源:FeedPanelContextProvider.java
示例2: shouldDisplay
import com.atlassian.crowd.embedded.api.User; //导入依赖的package包/类
public boolean shouldDisplay(User user, Issue issue, JiraHelper jiraHelper) {
ProjectRoleManager roleManager = (ProjectRoleManager)ComponentAccessor.getComponentOfType(ProjectRoleManager.class);
Collection<ProjectRole> roles = roleManager.getProjectRoles(user, jiraHelper.getProjectObject());
// Check if the user has the required role.
boolean hasJamRole = false;
for (ProjectRole role : roles) {
if (role.getName().equals(JamUser)) {
hasJamRole = true;
break;
}
}
if (!hasJamRole) {
return false;
}
// Check if we are filtering based on creation time or not.
if (displayIfNewerThanJam) {
Long jamTs = JamClient.getProjectJamTimestamp(issue.getProjectObject());
Long issueTs = issue.getCreated().getTime();
return (jamTs <= issueTs);
}
return true;
}
开发者ID:SAP,项目名称:SAPJamWorkPatternJIRAIntegration,代码行数:27,代码来源:CanAccessJamPluginCondition.java
示例3: updateGroupMemberships
import com.atlassian.crowd.embedded.api.User; //导入依赖的package包/类
private void updateGroupMemberships(HttpServletRequest request, Principal user, CrowdService crowdService, User crowdUser) {
if (user == null) {
if (log.isDebugEnabled()) {
log.debug("User is null, so can't update group memberships.");
}
} else {
Set roles = new HashSet();
// Add user to groups.
getRolesFromHeader(request, roles);
assignUserToRoles(user, config.getDefaultRoles(), crowdService, crowdUser);
assignUserToRoles(user, roles, crowdService, crowdUser);
// Make sure we don't purge default roles either
roles.addAll(config.getDefaultRoles());
purgeUserRoles(user, roles);
}
}
开发者ID:chauth,项目名称:jira_http_authenticator,代码行数:19,代码来源:RemoteUserAuthenticator.java
示例4: testAddNewUser
import com.atlassian.crowd.embedded.api.User; //导入依赖的package包/类
@Test
public void testAddNewUser() {
request.addHeader(PVPConstants.HTTP_HEADER_USERID, "[email protected]");
request.addHeader(PVPConstants.HTTP_HEADER_MAIL, "[email protected]");
request.addHeader(PVPConstants.HTTP_HEADER_CN, "Test User1");
request.addHeader(PVPConstants.HTTP_HEADER_ROLES, "project1-users();project1-developers");
Principal p = auth.getUser(request, resp);
assertNotNull(p);
assertEquals("[email protected]", p.getName());
assertEquals(1, crowdService.getUserList().size());
User user = crowdService.getUserList().get(0);
assertEquals("[email protected]", user.getName());
assertEquals("[email protected]", user.getEmailAddress());
assertEquals("Test User1", user.getDisplayName());
List<Group> groups = crowdService.getUser2Group().get(user);
assertEquals(2, groups.size());
assertEquals("project1-users", groups.get(0).getName());
assertEquals("project1-developers", groups.get(1).getName());
}
开发者ID:mschieder,项目名称:jira-pvp-sso,代码行数:23,代码来源:PVPAuthenticatorTest.java
示例5: getFirstValidAssignee
import com.atlassian.crowd.embedded.api.User; //导入依赖的package包/类
/**
* Given an array of addresses, returns the first valid assignee for the appropriate project.
*
* @param addresses the addresses
* @param project the project
* @return the first valid assignee for <code>project</code>
*/
public static User getFirstValidAssignee(Address[] addresses, Project project)
{
if (addresses == null || addresses.length == 0) {
return null;
}
for (int i = 0; i < addresses.length; i++) {
if (addresses[i] instanceof InternetAddress) {
InternetAddress email = (InternetAddress) addresses[i];
User validUser = UserUtils.getUserByEmail(email.getAddress());
if (validUser != null) {
log.error("The user meant no be an assignee is unknown.");
} else {
if (isValidAssignee(project, validUser)) {
return validUser;
}
}
}
}
return null;
}
开发者ID:bcopy,项目名称:JMH,代码行数:32,代码来源:AdvancedCreateIssueHandler.java
示例6: getIssueUtilsBean
import com.atlassian.crowd.embedded.api.User; //导入依赖的package包/类
/**
* Return a IssueUtilsBean which is a utility class from Atlassian to
* determine available workflow actions for a given user
*
* @param u
* The given user
* @return An IssueUtilsBean instance
*/
private IssueUtilsBean getIssueUtilsBean(User u) {
final ComponentManager cm = ComponentManager.getInstance();
final IssueManager im = cm.getIssueManager();
final WorkflowManager wfm = cm.getWorkflowManager();
// final PluginAccessor pa = cm.getPluginAccessor();
final JiraAuthenticationContext jac = cm.getJiraAuthenticationContext();
final IssueWorkflowManager iwfm = new IssueWorkflowManagerImpl(im, wfm, jac);
//jac.setUser(u);
jac.setLoggedInUser(u);
//IssueUtilsBean iub = new IssueUtilsBean(im, wfm, jac);
IssueUtilsBean iub = new IssueUtilsBean(wfm, jac, iwfm);
return iub;
}
开发者ID:bcopy,项目名称:JMH,代码行数:24,代码来源:AdvancedCreateOrCommentHandler.java
示例7: updateGroupMemberships
import com.atlassian.crowd.embedded.api.User; //导入依赖的package包/类
private void updateGroupMemberships(HttpServletRequest request, User user) {
if (user == null) {
if (log.isDebugEnabled()) {
log.debug("User is null, so can't update group memberships.");
}
} else {
Set roles = new HashSet();
// Add user to groups.
getRolesFromHeader(request, roles);
assignUserToRoles(user, config.getDefaultRoles(), user);
assignUserToRoles(user, roles, user);
// Make sure we don't purge default roles either
roles.addAll(config.getDefaultRoles());
purgeUserRoles(user, roles);
}
}
开发者ID:chauth,项目名称:confluence_http_authenticator,代码行数:19,代码来源:RemoteUserAuthenticator.java
示例8: getCrowdUser
import com.atlassian.crowd.embedded.api.User; //导入依赖的package包/类
private User getCrowdUser(String userid, HttpServletRequest request, String remoteHost, String remoteIP) {
CrowdService crowdService = getCrowdService();
if (crowdService == null) {
loginFailed(request, userid, remoteHost, remoteIP, "AuthenticatorConfigFailure");
if (log.isDebugEnabled()) {
log.debug("Authenticator is throwing RuntimeException from call to public boolean login(HttpServletRequest request, HttpServletResponse response, String username, String password, boolean cookie)");
}
throw new RuntimeException("crowdService was not wired in RemoteUserAuthenticator");
}
// ensure user is active
User crowdUser = crowdService.getUser(userid);
if (crowdUser != null && !crowdUser.isActive()) {
log.info("Login failed for user '" + userid + "', because user is set as inactive. remoteIP=" + remoteIP + " remoteHost=" + remoteHost);
loginFailed(request, userid, remoteHost, remoteIP, "UserInactive");
if (log.isDebugEnabled()) {
log.debug("Authenticator is returning null from call to public Principal getUser(HttpServletRequest request, HttpServletResponse response)");
}
return null;
}
return crowdUser;
}
开发者ID:chauth,项目名称:confluence_http_authenticator,代码行数:27,代码来源:RemoteUserAuthenticator.java
示例9: addUserToGroup
import com.atlassian.crowd.embedded.api.User; //导入依赖的package包/类
private void addUserToGroup(final User crowdUser, final Group group) {
if (crowdUser == null) {
log.warn("Cannot add null user to group!");
} else if (group == null) {
log.warn("Cannot add user to null group!");
} else {
new TransactionTemplate(getTransactionManager(), new DefaultTransactionAttribute(TransactionDefinition.PROPAGATION_REQUIRED)).execute(new TransactionCallback() {
public Object doInTransaction(TransactionStatus status) {
try {
getCrowdService().addUserToGroup(crowdUser, group);
} catch (Throwable t) {
log.error("Failed to add user " + crowdUser.getName() + " to group '" + group.getName() + "'!", t);
}
return null;
}
});
}
}
开发者ID:chauth,项目名称:confluence_http_authenticator,代码行数:19,代码来源:RemoteUserAuthenticator.java
示例10: removeUserFromGroup
import com.atlassian.crowd.embedded.api.User; //导入依赖的package包/类
private void removeUserFromGroup(final CrowdService crowdService, final User crowdUser, final Group group) {
if (crowdUser == null) {
log.warn("Cannot remove null user from group!");
} else if (group == null) {
log.warn("Cannot remove user from null group!");
} else {
new TransactionTemplate(getTransactionManager(), new DefaultTransactionAttribute(TransactionDefinition.PROPAGATION_REQUIRED)).execute(new TransactionCallback() {
public Object doInTransaction(TransactionStatus status) {
try {
crowdService.removeUserFromGroup(crowdUser, group);
} catch (Throwable t) {
log.error("Failed to remove user " + crowdUser.getName() + " from group '" + group.getName() + "'!", t);
}
return null;
}
});
}
}
开发者ID:chauth,项目名称:confluence_http_authenticator,代码行数:19,代码来源:RemoteUserAuthenticator.java
示例11: updateUser
import com.atlassian.crowd.embedded.api.User; //导入依赖的package包/类
private void updateUser(final CrowdService crowdService, final User crowdUser) {
if (crowdUser != null) {
new TransactionTemplate(getTransactionManager(), new DefaultTransactionAttribute(TransactionDefinition.PROPAGATION_REQUIRED)).execute(new TransactionCallback() {
public Object doInTransaction(TransactionStatus status) {
try {
crowdService.updateUser(crowdUser);
} catch (Throwable t) {
log.error("Failed to update user '" + crowdUser.getName() + "'!", t);
}
return null;
}
});
} else {
log.warn("Cannot update null user!");
}
}
开发者ID:chauth,项目名称:confluence_http_authenticator,代码行数:17,代码来源:RemoteUserAuthenticator.java
示例12: testFindCommitInLogEntriesForProject
import com.atlassian.crowd.embedded.api.User; //导入依赖的package包/类
/**
* Tests that we find a particular commit in the log entries for a project.
*
* @param user
* @param issue
* @throws IndexException
* @throws URISyntaxException
* @throws RepositoryException
* @throws IOException
*/
@SuppressWarnings("deprecation")
@Test
public void testFindCommitInLogEntriesForProject(final User user, final MutableIssue issue) throws IndexException, URISyntaxException, RepositoryException, IOException {
new NonStrictExpectations() {{
issueManager.getIssueObject(anyString); result = issue;
permissionManager.hasPermission(Permissions.VIEW_VERSION_CONTROL, withAny(issue), user); result = true;
changeHistoryManager.getPreviousIssueKeys(anyLong); result = new ArrayList<String>();
repositoryManager.parseRepositoryId("id"); result = "id"; minTimes = 1;
repositoryManager.getRepository("id"); result = new GitRepository("id"); minTimes = 1;
}};
// Create the index for the test repository
testIndex();
// Look for a particular commit
final Iterator<LogEntry<GitRepository, GitCommitKey>> logEntries =
commitIndexer.getAllLogEntriesByProject("GCV", user, 0, 5, false).iterator();
Assert.assertTrue("Expected to find marker commit in history", hasCommit("095014f90aac621901d29e1e3986ad5f9e52361a", logEntries));
}
开发者ID:astralbat,项目名称:gitcommitviewer,代码行数:30,代码来源:GitCommitIndexerTest.java
示例13: testFindCommitInLogEntriesForVersion
import com.atlassian.crowd.embedded.api.User; //导入依赖的package包/类
/**
* Tests that we find a particular commit in the log entries for a version.
*
* @param version
* @param user
* @param issue
* @throws IndexException
* @throws URISyntaxException
* @throws RepositoryException
* @throws IOException
*/
@SuppressWarnings("deprecation")
@Test
public void testFindCommitInLogEntriesForVersion(final Version version, final User user, final MutableIssue issue) throws IndexException, URISyntaxException, RepositoryException, IOException {
new NonStrictExpectations() {{
versionManager.getIssuesWithFixVersion(version); result = Arrays.asList(new Issue[] { issue });
issueManager.getIssueObject(anyString); result = issue;
issue.getKey(); result = "GCV-1";
permissionManager.hasPermission(Permissions.VIEW_VERSION_CONTROL, withAny(issue), user); result = true;
changeHistoryManager.getPreviousIssueKeys(anyLong); result = new ArrayList<String>();
repositoryManager.parseRepositoryId("id"); result = "id"; minTimes = 1;
repositoryManager.getRepository("id"); result = new GitRepository("id"); minTimes = 1;
}};
// Create the index for the test repository
testIndex();
// Look for a particular commit
final Iterator<LogEntry<GitRepository, GitCommitKey>> logEntries =
commitIndexer.getAllLogEntriesByVersion(version, user, 0, 5, false).iterator();
Assert.assertTrue("Expected to find marker commit in history", hasCommit("095014f90aac621901d29e1e3986ad5f9e52361a", logEntries));
}
开发者ID:astralbat,项目名称:gitcommitviewer,代码行数:33,代码来源:GitCommitIndexerTest.java
示例14: getActions
import com.atlassian.crowd.embedded.api.User; //导入依赖的package包/类
@Override
public List<IssueAction> getActions(Issue currentIssue, User currentUser) {
final List<IssueAction> actions = new ArrayList<IssueAction>();
actions.add(new IssueAction() {
@Override
public boolean isDisplayActionAllTab() {
return false;
}
@Override
public Date getTimePerformed() {
return new Date();
}
@Override
public String getHtml() {
return issueTabPanelModuleDescriptor.getHtml(ISSUE_TAB_PANEL_VELOCITY_TEMPLATE);
}
});
return actions;
}
开发者ID:jeanarcand,项目名称:foresight,代码行数:24,代码来源:IssueDependencyTabPanel.java
示例15: getTokenRequest
import com.atlassian.crowd.embedded.api.User; //导入依赖的package包/类
public String getTokenRequest(final String username)
{
User user = UserUtils.getUser(username);
String emailAddress = user.getEmailAddress();
Assertion assertion = buildSAMLAssertion(emailAddress);
String signedAssertion = signAssertion(assertion);
List<NameValuePair> postParams = new ArrayList<NameValuePair>();
postParams.add(new BasicNameValuePair("client_id", clientID));
postParams.add(new BasicNameValuePair("grant_type", GRANT_TYPE));
postParams.add(new BasicNameValuePair("assertion", signedAssertion));
return URLEncodedUtils.format(postParams, "UTF-8");
}
开发者ID:SAP,项目名称:SAPJamWorkPatternJIRAIntegration,代码行数:16,代码来源:JamConsumer.java
示例16: getContextMap
import com.atlassian.crowd.embedded.api.User; //导入依赖的package包/类
public Map getContextMap(User user, JiraHelper jiraHelper) {
Map contextMap = jiraHelper.getContextParams();
Issue issue = (Issue)contextMap.get("issue");
List<Group> groups = jamClient.getIssueGroups(issue);
contextMap.put("groups", groups);
return contextMap;
}
开发者ID:SAP,项目名称:SAPJamWorkPatternJIRAIntegration,代码行数:10,代码来源:GroupListingContextProvider.java
示例17: authenticate
import com.atlassian.crowd.embedded.api.User; //导入依赖的package包/类
private void authenticate(HttpServletRequest request) throws ODataException
{
final String authorization = request.getHeader("Authorization");
if (authorization != null && authorization.startsWith("Bearer "))
{
String token = authorization.substring("Bearer".length()).trim();
// Initialize JIRA services
AuthenticationConfigurationManager authenticationConfigurationManager = ComponentAccessor.getOSGiComponentInstanceOfType(AuthenticationConfigurationManager.class);
ApplicationLinkService applicationLinkService = ComponentAccessor.getOSGiComponentInstanceOfType(ApplicationLinkService.class);
JamConsumerProviderStore jamConsumerProviderStore = new JamConsumerProviderStore(authenticationConfigurationManager);
ServiceProvider jamServiceProvider = jamConsumerProviderStore.getServiceProvider(applicationLinkService.getPrimaryApplicationLink(JamApplicationType.class));
if ( jamServiceProvider != null )
{
OAuth2Token jamToken = jamServiceProvider.getTokenFromBearerToken(token);
if ( jamToken != null ) {
User user = ComponentAccessor.getUserUtil().getUserObject(jamToken.getUsername());
if ( user != null ) {
// Set the current user context to this user!
ComponentAccessor.getJiraAuthenticationContext().setLoggedInUser(user);
return;
}
}
}
}
throw new ODataUnauthorizedException();
}
开发者ID:SAP,项目名称:SAPJamWorkPatternJIRAIntegration,代码行数:31,代码来源:JiraODataProcessor.java
示例18: addUserToGroup
import com.atlassian.crowd.embedded.api.User; //导入依赖的package包/类
private void addUserToGroup(final CrowdService crowdService, final User crowdUser, final Group group) {
if (crowdUser == null) {
log.warn("Cannot add null user to group!");
} else if (group == null) {
log.warn("Cannot add user to null group!");
} else {
try {
crowdService.addUserToGroup(crowdUser, group);
} catch (Throwable t) {
log.error("Failed to add user " + crowdUser.getName() + " to group '" + group.getName() + "'!", t);
}
}
}
开发者ID:chauth,项目名称:jira_http_authenticator,代码行数:14,代码来源:RemoteUserAuthenticator.java
示例19: removeUserFromGroup
import com.atlassian.crowd.embedded.api.User; //导入依赖的package包/类
private void removeUserFromGroup(final CrowdService crowdService, final User crowdUser, final Group group) {
if (crowdUser == null) {
log.warn("Cannot remove null user from group!");
} else if (group == null) {
log.warn("Cannot remove user from null group!");
} else {
try {
crowdService.removeUserFromGroup(crowdUser, group);
} catch (Throwable t) {
log.error("Failed to remove user " + crowdUser.getName() + " from group '" + group.getName() + "'!", t);
}
}
}
开发者ID:chauth,项目名称:jira_http_authenticator,代码行数:14,代码来源:RemoteUserAuthenticator.java
示例20: updateUser
import com.atlassian.crowd.embedded.api.User; //导入依赖的package包/类
private void updateUser(final CrowdService crowdService, final User crowdUser) {
if (crowdUser != null) {
try {
crowdService.updateUser(crowdUser);
} catch (Throwable t) {
log.error("Failed to update user '" + crowdUser.getName() + "'!", t);
}
} else {
log.warn("Cannot update null user!");
}
}
开发者ID:chauth,项目名称:jira_http_authenticator,代码行数:12,代码来源:RemoteUserAuthenticator.java
注:本文中的com.atlassian.crowd.embedded.api.User类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论