Permalink
Browse files

OpenACD: remove agent pin, use user's pintoken instead.

  • Loading branch information...
1 parent 367e86b commit 8444b4339b6c618dd1f71db455e8c0ddc5a2484e ciuc committed Mar 13, 2012
View
4 sipXconfig/etc/sipxpbx/database/database.xml
@@ -413,6 +413,7 @@
<antcall target="openacd-add-release-codes" />
<antcall target="alarm-drop-pkey" />
<antcall target="openacd-add-queuegroup-recipe" />
+ <antcall target="openacd-agent-remove-pin" />
</target>
<target name="plugin-patches">
@@ -1287,6 +1288,9 @@
<target name="openacd-add-queuegroup-recipe" unless="openacd-add-queuegroup-recipe">
<db-patch patch="openacd-add-queuegroup-recipe" />
</target>
+ <target name="openacd-agent-remove-pin" unless="openacd-agent-remove-pin">
+ <db-patch patch="openacd-agent-remove-pin" />
+ </target>
<!--
- SUPPORT UTILITIES
View
1 sipXconfig/etc/sipxpbx/database/openacd-agent-remove-pin.sql
@@ -0,0 +1 @@
+alter table openacd_agent drop column pin;
View
1 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/commserver/imdb/OpenAcd.java
@@ -31,6 +31,7 @@ public boolean generate(Replicable entity, DBObject top) {
}
top.put(MongoConstants.UUID, UUID.randomUUID().toString());
top.put(MongoConstants.TYPE, entity.getClass().getSimpleName().toString().toLowerCase());
+ top.put(MongoConstants.REALM, getCoreContext().getAuthorizationRealm());
return true;
}
View
12 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/openacd/OpenAcdAgent.java
@@ -24,7 +24,6 @@
import java.util.Map;
import java.util.Set;
-import org.apache.commons.lang.RandomStringUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
@@ -57,7 +56,6 @@ public String toString() {
private OpenAcdAgentGroup m_group;
private User m_user;
- private String m_pin = RandomStringUtils.randomAlphanumeric(8);
private String m_security = Security.AGENT.toString(); // default 'AGENT'
private String m_oldName;
@@ -77,14 +75,6 @@ public void setUser(User user) {
m_user = user;
}
- public String getPin() {
- return m_pin;
- }
-
- public void setPin(String pin) {
- m_pin = pin;
- }
-
public String getSecurity() {
return m_security;
}
@@ -124,7 +114,6 @@ public void setOldName(String oldName) {
@Override
public Map<String, Object> getMongoProperties(String domain) {
Map<String, Object> props = new HashMap<String, Object>();
- props.put(MongoConstants.PIN, getPin());
List<String> skills = new ArrayList<String>();
for (OpenAcdSkill skill : getSkills()) {
skills.add(skill.getAtom());
@@ -146,6 +135,7 @@ public void setOldName(String oldName) {
props.put(MongoConstants.SECURITY, getSecurity());
props.put(MongoConstants.AGENT_GROUP, getAgentGroup());
props.put(MongoConstants.CONTACT, getUser().getIdentity(domain));
+ props.put(MongoConstants.PINTOKEN, getUser().getPintoken());
return props;
}
View
3 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/openacd/OpenAcdContextImpl.java
@@ -363,9 +363,6 @@ public void saveAgent(OpenAcdAgent agent) {
}
private void checkAgent(OpenAcdAgent agent) {
- if (StringUtils.isBlank(agent.getPin())) {
- throw new UserException("&blank.agentPin.error");
- }
// check if agent security is empty
if (StringUtils.isBlank(agent.getSecurity())) {
throw new UserException("&blank.agentSecurity.error");
View
1 sipXconfig/neoconf/src/org/sipfoundry/sipxconfig/openacd/openacd.hbm.xml
@@ -35,7 +35,6 @@
<param name="sequence">openacd_agent_seq</param>
</generator>
</id>
- <property name="pin"/>
<property name="security"/>
<many-to-one name="group" class="OpenAcdAgentGroup" column="openacd_agent_group_id" not-null="true" lazy="proxy"
foreign-key="fk_openacd_agent_group" />
View
8 sipXconfig/neoconf/test/org/sipfoundry/sipxconfig/openacd/OpenAcdContextTestIntegration.java
@@ -276,15 +276,13 @@ public void testOpenAcdAgentGroupCrud() throws Exception {
OpenAcdAgent supervisor = new OpenAcdAgent();
supervisor.setGroup(group);
supervisor.setUser(alpha);
- supervisor.setPin("123456");
supervisor.setSecurity(OpenAcdAgent.Security.SUPERVISOR.toString());
m_openAcdContext.saveAgent(supervisor);
User beta = m_coreContext.loadUser(1002);
OpenAcdAgent agent = new OpenAcdAgent();
agent.setGroup(group);
agent.setUser(beta);
- agent.setPin("123457");
agent.setSecurity(OpenAcdAgent.Security.AGENT.toString());
m_openAcdContext.saveAgent(agent);
@@ -377,7 +375,6 @@ public void testOpenAcdAgentCrud() throws Exception {
assertEquals(0, m_openAcdContext.getAgents().size());
agent.setGroup(group);
agent.setUser(charlie);
- agent.setPin("123456");
m_openAcdContext.saveAgent(agent);
MongoTestCaseHelper.assertObjectWithFieldsValuesPresent(getEntityCollection(), new String[] {
MongoConstants.TYPE, MongoConstants.NAME, MongoConstants.AGENT_GROUP
@@ -397,7 +394,6 @@ public void testOpenAcdAgentCrud() throws Exception {
Set<OpenAcdAgent> agents = group.getAgents();
OpenAcdAgent savedAgent = DataAccessUtils.singleResult(agents);
assertEquals(charlie, savedAgent.getUser());
- assertEquals("123456", savedAgent.getPin());
assertEquals("AGENT", savedAgent.getSecurity());
// test get agent by id
@@ -420,13 +416,11 @@ public void testOpenAcdAgentCrud() throws Exception {
OpenAcdAgent agent1 = new OpenAcdAgent();
agent1.setGroup(grp);
- agent1.setPin("1234");
agent1.setUser(delta);
m_openAcdContext.saveAgent(agent1);
OpenAcdAgent agent2 = new OpenAcdAgent();
agent2.setGroup(grp);
- agent2.setPin("123433");
agent2.setUser(elephant);
m_openAcdContext.saveAgent(agent2);
@@ -458,7 +452,6 @@ public void testOpenAcdAgentCrud() throws Exception {
m_coreContext.saveUser(newAgent);
OpenAcdAgent agent3 = new OpenAcdAgent();
agent3.setGroup(newGroup);
- agent3.setPin("123433");
agent3.setUser(newAgent);
m_openAcdContext.saveAgent(agent3);
assertEquals(3, m_openAcdContext.getAgents().size());
@@ -695,7 +688,6 @@ public void testManageAgentWithSkill() throws Exception {
OpenAcdAgent agent = new OpenAcdAgent();
agent.setGroup(group);
agent.setUser(charlie);
- agent.setPin("123456");
agent.addSkill(englishSkill);
m_openAcdContext.saveAgent(agent);
assertTrue(m_openAcdContext.getAgentByUser(charlie).getSkills().contains(englishSkill));
View
19 sipXconfig/web/context/WEB-INF/user_portal/EditMyInformation.html
@@ -99,22 +99,3 @@
<span jwcid="@user_portal/MyAssistantComponent" user="ognl:user"/>
</form>
</div>
-<div jwcid="openAcdTab@Block">
- <form jwcid="openAcdForm@Form" delegate="bean:validator">
- <fieldset>
- <table>
- <tr jwcid="openAcdPin@user/ConfirmPassword"
- password="ognl:openAcdPin"
- passwordDisplayName="message:label.openAcd.pin"
- confirmPasswordDisplayName="message:label.openAcd.pin2"
- passwordMismatchMessage="message:error.pinMismatch"
- passwordDescription="message:description.agentPassword">
- </tr>
- </table>
- </fieldset>
- <input id="saveOpenAcdPin"
- jwcid="saveOpenAcdPin@Submit"
- listener="listener:saveOpenAcdPin"
- value="message:label.saveOpenAcdPin" />
- </form>
-</div>
View
25 sipXconfig/web/src/org/sipfoundry/sipxconfig/site/user_portal/EditMyInformation.java
@@ -24,8 +24,6 @@
import org.sipfoundry.sipxconfig.components.TapestryUtils;
import org.sipfoundry.sipxconfig.conference.Conference;
import org.sipfoundry.sipxconfig.conference.ConferenceBridgeContext;
-import org.sipfoundry.sipxconfig.openacd.OpenAcdAgent;
-import org.sipfoundry.sipxconfig.openacd.OpenAcdContext;
import org.sipfoundry.sipxconfig.permission.Permission;
import org.sipfoundry.sipxconfig.setting.Setting;
import org.sipfoundry.sipxconfig.site.user.EditPinComponent;
@@ -36,7 +34,6 @@
public abstract class EditMyInformation extends UserBasePage implements EditPinComponent {
public static final String TAB_CONFERENCES = "conferences";
- public static final String TAB_OPENACD = "openAcd";
//private static final String OPERATOR_SETTING = "personal-attendant" + Setting.PATH_DELIM + "operator";
@@ -52,9 +49,6 @@
// @InjectObject("spring:xmppContactInformationUpdate")
// public abstract XmppContactInformationUpdate getXmppContactInformationUpdate();
- @InjectObject("spring:openAcdContext")
- public abstract OpenAcdContext getOpenAcdContext();
-
public abstract String getPin();
public abstract Conference getCurrentRow();
@@ -94,10 +88,6 @@
public abstract void setImNotificationSettings(Setting paSetting);
- public abstract String getOpenAcdPin();
-
- public abstract void setOpenAcdPin(String pin);
-
public abstract Setting getParentSetting();
public abstract void setParentSetting(Setting setting);
@@ -155,10 +145,6 @@ public void pageBeginRender(PageEvent event) {
setActionBlockForConferencesTab(b);
}
- if (getTab().equals(TAB_OPENACD)) {
- OpenAcdAgent agent = getOpenAcdContext().getAgentByUser(user);
- setOpenAcdPin(agent.getPin());
- }
}
public void syncXmppContacts() {
@@ -191,18 +177,7 @@ private void initAvailableTabs() {
// tabNames.add("myAssistant");
// }
- if (getOpenAcdContext().isOpenAcdAgent(getUser())) {
- tabNames.add(TAB_OPENACD);
- }
-
setAvailableTabNames(tabNames);
}
- public void saveOpenAcdPin() {
- OpenAcdAgent agent = getOpenAcdContext().getAgentByUser(getUser());
- agent.setPin(getOpenAcdPin());
- getOpenAcdContext().saveAgent(agent);
- getValidator().recordSuccess(getMessages().getMessage("label.openAcdPin.changed"));
- }
-
}

0 comments on commit 8444b43

Please sign in to comment.