本文整理汇总了Java中com.atlassian.crowd.embedded.api.Group类的典型用法代码示例。如果您正苦于以下问题:Java Group类的具体用法?Java Group怎么用?Java Group使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Group类属于com.atlassian.crowd.embedded.api包,在下文中一共展示了Group类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testAddNewUser
import com.atlassian.crowd.embedded.api.Group; //导入依赖的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
示例2: addUserToGroup
import com.atlassian.crowd.embedded.api.Group; //导入依赖的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
示例3: removeUserFromGroup
import com.atlassian.crowd.embedded.api.Group; //导入依赖的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
示例4: addGroup
import com.atlassian.crowd.embedded.api.Group; //导入依赖的package包/类
private void addGroup(final CrowdService crowdService, final Group group) {
if (group != null) {
try {
crowdService.addGroup(group);
} catch (Throwable t) {
log.error("Failed to add group '" + group.getName() + "'!", t);
}
} else {
log.warn("Cannot add null group!");
}
}
开发者ID:chauth,项目名称:jira_http_authenticator,代码行数:12,代码来源:RemoteUserAuthenticator.java
示例5: addUserToGroup
import com.atlassian.crowd.embedded.api.Group; //导入依赖的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
示例6: removeUserFromGroup
import com.atlassian.crowd.embedded.api.Group; //导入依赖的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
示例7: addUserToGroup
import com.atlassian.crowd.embedded.api.Group; //导入依赖的package包/类
private void addUserToGroup(ApplicationUser newUser) throws GroupNotFoundException, UserNotFoundException, OperationNotPermittedException, OperationFailedException {
GroupManager groupManager = ComponentAccessor.getGroupManager();
String defaultGroup = saml2Config.getAutoCreateUserDefaultGroup();
if (defaultGroup.isEmpty()) {
defaultGroup = SAMLJiraConfig.DEFAULT_AUTOCREATE_USER_GROUP;
}
Group defaultJiraGroup = groupManager.getGroup(defaultGroup);
if (defaultJiraGroup != null) {
groupManager.addUserToGroup(newUser, defaultJiraGroup);
}
}
开发者ID:bitium,项目名称:jira-saml-plugin,代码行数:12,代码来源:SsoJiraLoginServlet.java
示例8: getExistingGroups
import com.atlassian.crowd.embedded.api.Group; //导入依赖的package包/类
public ArrayList<String> getExistingGroups() {
GroupManager groupManager = ComponentAccessor.getGroupManager();
Collection<Group> groupObjects = groupManager.getAllGroups();
existingGroups = new ArrayList<String>();
for (Group groupObject : groupObjects) {
existingGroups.add(groupObject.getName());
}
setExistingGroups(existingGroups);
return existingGroups;
}
开发者ID:bitium,项目名称:jira-saml-plugin,代码行数:11,代码来源:ConfigureAction.java
示例9: getGroupsForUser
import com.atlassian.crowd.embedded.api.Group; //导入依赖的package包/类
@Override
public SortedSet<Group> getGroupsForUser(String user) {
List<Group> groups = user2Group.get(user);
SortedSet<Group> ret = new TreeSet<>();
if (groups != null) {
ret.addAll(groups);
}
return ret;
}
开发者ID:mschieder,项目名称:jira-pvp-sso,代码行数:11,代码来源:FakeCrowdService.java
示例10: addGroupToGroup
import com.atlassian.crowd.embedded.api.Group; //导入依赖的package包/类
@Override
public boolean addGroupToGroup(Group arg0, Group arg1)
throws GroupNotFoundException, OperationNotPermittedException,
InvalidMembershipException, OperationFailedException {
return false;
}
开发者ID:mschieder,项目名称:jira-pvp-sso,代码行数:8,代码来源:FakeCrowdService.java
示例11: addUser
import com.atlassian.crowd.embedded.api.Group; //导入依赖的package包/类
@Override
public User addUser(User user, String arg1) throws InvalidUserException,
InvalidCredentialException, OperationNotPermittedException,
OperationFailedException {
userList.add(user);
user2Group.put(user, new ArrayList<Group>());
return user;
}
开发者ID:mschieder,项目名称:jira-pvp-sso,代码行数:10,代码来源:FakeCrowdService.java
示例12: addUserToGroup
import com.atlassian.crowd.embedded.api.Group; //导入依赖的package包/类
@Override
public boolean addUserToGroup(User user, Group group)
throws GroupNotFoundException, UserNotFoundException,
OperationNotPermittedException, OperationFailedException {
return user2Group.get(user).add(group);
}
开发者ID:mschieder,项目名称:jira-pvp-sso,代码行数:9,代码来源:FakeCrowdService.java
示例13: getGroup
import com.atlassian.crowd.embedded.api.Group; //导入依赖的package包/类
@Override
public Group getGroup(final String name) {
return new Group() {
@Override
public String getName() {
return name;
}
@Override
public int compareTo(Group group) {
return name.compareTo(group.getName());
}
};
}
开发者ID:mschieder,项目名称:jira-pvp-sso,代码行数:16,代码来源:FakeCrowdService.java
示例14: removeGroupFromGroup
import com.atlassian.crowd.embedded.api.Group; //导入依赖的package包/类
@Override
public boolean removeGroupFromGroup(Group arg0, Group arg1)
throws GroupNotFoundException, OperationNotPermittedException,
OperationFailedException {
return false;
}
开发者ID:mschieder,项目名称:jira-pvp-sso,代码行数:8,代码来源:FakeCrowdService.java
示例15: removeUserFromGroup
import com.atlassian.crowd.embedded.api.Group; //导入依赖的package包/类
@Override
public boolean removeUserFromGroup(User arg0, Group arg1)
throws GroupNotFoundException, UserNotFoundException,
OperationNotPermittedException, OperationFailedException {
return false;
}
开发者ID:mschieder,项目名称:jira-pvp-sso,代码行数:8,代码来源:FakeCrowdService.java
示例16: updateGroup
import com.atlassian.crowd.embedded.api.Group; //导入依赖的package包/类
@Override
public Group updateGroup(Group arg0) throws GroupNotFoundException,
InvalidGroupException, OperationNotPermittedException,
OperationFailedException {
return null;
}
开发者ID:mschieder,项目名称:jira-pvp-sso,代码行数:8,代码来源:FakeCrowdService.java
示例17: getHubJiraAdminConfiguration
import com.atlassian.crowd.embedded.api.Group; //导入依赖的package包/类
@Path("/admin")
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getHubJiraAdminConfiguration(@Context final HttpServletRequest request) {
final Object adminConfig;
try {
final String username = userManager.getRemoteUsername(request);
if (username == null) {
return Response.status(Status.UNAUTHORIZED).build();
}
final boolean userIsSysAdmin = userManager.isSystemAdmin(username);
final PluginSettings settings = pluginSettingsFactory.createGlobalSettings();
final String oldHubJiraGroupsString = getStringValue(settings, HubJiraConfigKeys.HUB_CONFIG_JIRA_GROUPS);
final String hubJiraGroupsString;
if (StringUtils.isNotBlank(oldHubJiraGroupsString)) {
hubJiraGroupsString = oldHubJiraGroupsString;
setValue(settings, HubJiraConfigKeys.HUB_CONFIG_JIRA_GROUPS, null);
setValue(settings, HubJiraConfigKeys.HUB_CONFIG_GROUPS, hubJiraGroupsString);
} else {
hubJiraGroupsString = getStringValue(settings, HubJiraConfigKeys.HUB_CONFIG_GROUPS);
}
if (!userIsSysAdmin) {
if (StringUtils.isBlank(hubJiraGroupsString)) {
return Response.status(Status.UNAUTHORIZED).build();
} else {
final String[] hubJiraGroups = hubJiraGroupsString.split(",");
boolean userIsInGroups = false;
for (final String hubJiraGroup : hubJiraGroups) {
if (userManager.isUserInGroup(username, hubJiraGroup.trim())) {
userIsInGroups = true;
break;
}
}
if (!userIsInGroups) {
return Response.status(Status.UNAUTHORIZED).build();
}
}
}
adminConfig = transactionTemplate.execute(new TransactionCallback() {
@Override
public Object doInTransaction() {
final HubAdminConfigSerializable txAdminConfig = new HubAdminConfigSerializable();
txAdminConfig.setHubJiraGroups(hubJiraGroupsString);
if (userIsSysAdmin) {
final List<String> jiraGroups = new ArrayList<>();
final Collection<Group> jiraGroupCollection = groupPickerSearchService.findGroups("");
if (jiraGroupCollection != null && !jiraGroupCollection.isEmpty()) {
for (final Group group : jiraGroupCollection) {
jiraGroups.add(group.getName());
}
}
txAdminConfig.setJiraGroups(jiraGroups);
}
return txAdminConfig;
}
});
} catch (final Exception e) {
final HubAdminConfigSerializable errorAdminConfig = new HubAdminConfigSerializable();
final String msg = "Error getting admin config: " + e.getMessage();
logger.error(msg, e);
errorAdminConfig.setHubJiraGroupsError(msg);
return Response.ok(errorAdminConfig).build();
}
return Response.ok(adminConfig).build();
}
开发者ID:blackducksoftware,项目名称:hub-jira,代码行数:68,代码来源:HubJiraConfigController.java
示例18: getGroup
import com.atlassian.crowd.embedded.api.Group; //导入依赖的package包/类
@Override
public Group getGroup(final String arg0) {
return null;
}
开发者ID:blackducksoftware,项目名称:hub-jira,代码行数:6,代码来源:UserUtilMock.java
示例19: getGroupObject
import com.atlassian.crowd.embedded.api.Group; //导入依赖的package包/类
@Override
public Group getGroupObject(final String arg0) {
return null;
}
开发者ID:blackducksoftware,项目名称:hub-jira,代码行数:6,代码来源:UserUtilMock.java
示例20: getGroupsForUser
import com.atlassian.crowd.embedded.api.Group; //导入依赖的package包/类
@Override
public SortedSet<Group> getGroupsForUser(final String arg0) {
return null;
}
开发者ID:blackducksoftware,项目名称:hub-jira,代码行数:6,代码来源:UserUtilMock.java
注:本文中的com.atlassian.crowd.embedded.api.Group类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论