本文整理汇总了Java中com.atlassian.crowd.embedded.api.Group类的典型用法代码示例。如果您正苦于以下问题:Java Group类的具体用法?Java Group怎么用?Java Group使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Group类属于com.atlassian.crowd.embedded.api包,在下文中一共展示了Group类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
示例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;
}
});
}
}
示例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;
}
});
}
}
示例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!");
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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());
}
};
}
示例14: removeGroupFromGroup
import com.atlassian.crowd.embedded.api.Group; //导入依赖的package包/类
@Override
public boolean removeGroupFromGroup(Group arg0, Group arg1)
throws GroupNotFoundException, OperationNotPermittedException,
OperationFailedException {
return false;
}
示例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;
}