public GroupEditPage(final PageParameters parameters, final String selectProperty) { super(parameters, "group"); this.selectProperty = selectProperty; super.init(); final String groupName = WicketUtils.getAsString(parameters, PARAM_GROUP_NAME); if (StringUtils.isNotEmpty(groupName) == true) { getData().setName(groupName); } }
private GroupDO createGroup(final String name, final String... usernames) { final GroupDO group = new GroupDO(); group.setName(name); if (usernames != null) { for (final String username : usernames) { final PFUserDO user = getRequiredUser(username); if (user == null) { return null; } group.addUser(user); } } return group; }
/** * Prevents changing the group name for ProjectForge groups. * * @see org.projectforge.framework.persistence.api.BaseDao#onChange(org.projectforge.core.ExtendedBaseDO, * org.projectforge.core.ExtendedBaseDO) */ @Override protected void onChange(final GroupDO obj, final GroupDO dbObj) { for (final ProjectForgeGroup group : ProjectForgeGroup.values()) { if (group.getName().equals(dbObj.getName()) == true) { // A group of ProjectForge will be changed. if (group.getName().equals(obj) == false) { // The group's name must be unmodified! log.warn( "Preventing the change of ProjectForge's group '" + group.getName() + "' in '" + obj.getName() + "'."); obj.setName(group.getName()); } break; } } }
/** * Creates a group with the given name and id. * * @param name * @param id */ private GroupDO cg(final String name, final int id) { final GroupDO group = new GroupDO(); group.setName(name).setId(id); return group; }
private Integer createGroup(final String name, final String description) { final GroupDO group = new GroupDO().setName(name).setDescription(description); return (Integer) groupDao.internalSave(group); }
private void addGroup(final ProjectForgeGroup projectForgeGroup, final String description, final TenantDO tenant, final Set<PFUserDO> users) { final GroupDO group = new GroupDO(); group.setName(projectForgeGroup.toString()); group.setDescription(description); if (users != null) { group.setAssignedUsers(users); } group.setTenant(tenant); // group.setNestedGroupsAllowed(false); group.setLocalGroup(true); // Do not synchronize group with external user management system by default. groupDao.internalSave(group); }
public GroupDO addGroup(final String groupname, final String... usernames) { final GroupDO group = new GroupDO(); group.setName(groupname); if (usernames != null) { final Set<PFUserDO> col = new HashSet<PFUserDO>(); for (final String username : usernames) { col.add(getUser(username)); } group.setAssignedUsers(col); } groupDao.internalSave(group); putGroup(group); TenantRegistryMap.getInstance().setAllUserGroupCachesAsExpired(); return group; }
emf.runInTrans(emgr -> { GroupDO hrGroup = new GroupDO(); hrGroup.setName("PF_HR"); hrGroup.setDescription("Users for having full access to the companies hr."); hrGroup.setCreated();
public GroupDO convert(final LdapGroup ldapGroup) { final GroupDO group = new GroupDO(); group.setId(getId(ldapGroup)); group.setName(ldapGroup.getCommonName()); group.setOrganization(ldapGroup.getOrganization()); group.setDescription(ldapGroup.getDescription()); if (isPosixAccountValuesEmpty(ldapGroup) == false) { group.setLdapValues(getLdapValuesAsXml(ldapGroup)); } return group; }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Test public void test3CheckUnmodifiableGroupNames() { GroupDO adminGroup = getGroup(ProjectForgeGroup.ADMIN_GROUP.getName()); final Integer id = adminGroup.getId(); adminGroup.setName("Changed admin group"); groupDao.internalSave(adminGroup); adminGroup = groupDao.internalGetById(id); assertEquals("Group's name shouldn't be allowed to change.", ProjectForgeGroup.ADMIN_GROUP.getName(), adminGroup.getName()); } }
GroupDao groupDao = applicationContext.getBean(GroupDao.class); GroupDO orgaGroup = new GroupDO(); orgaGroup.setName(ProjectForgeGroup.ORGA_TEAM.getName()); groupDao.internalSave(orgaGroup);
@Override public Object doInTransaction(final TransactionStatus status) { logon(TEST_ADMIN_USER); GroupDO group = new GroupDO(); group.setName("testgroup"); final Set<PFUserDO> assignedUsers = new HashSet<PFUserDO>(); group.setAssignedUsers(assignedUsers); assignedUsers.add(getUser(TEST_USER)); final Serializable id = groupDao.save(group); group = groupDao.getById(id); assertEquals("testgroup", group.getName()); assertEquals(1, group.getAssignedUsers().size()); assertTrue(group.getAssignedUsers().contains(getUser(TEST_USER))); final PFUserDO user = getUser(TEST_USER2); assertNotNull(user); group.getAssignedUsers().add(user); groupDao.update(group); group = groupDao.getById(id); assertEquals(2, group.getAssignedUsers().size()); assertTrue(group.getAssignedUsers().contains(getUser(TEST_USER))); assertTrue(group.getAssignedUsers().contains(user)); return null; } });
name.add((IValidator<String>) validatable -> { final String groupname = validatable.getValue(); getData().setName(groupname); if (groupDao.doesGroupnameAlreadyExist(getData()) == true) { validatable.error(new ValidationError().addKey("fibu.kost.error.invalidKost"));