Пример #1
0
  public void testAddUser() throws Exception {
    List<Map<String, String>> items = new ArrayList<Map<String, String>>();

    PermissionManagerImpl pm = new PermissionManagerImpl();
    pm.setModelFilesContext(TestHelper.getModelFilesContext());

    User user = new User();
    user.setPermissionManager(pm);

    Group g = new Group();
    PermissionName.INTERNATIONAL_DIALING.setEnabled(g, false);
    PermissionName.LONG_DISTANCE_DIALING.setEnabled(g, false);
    PermissionName.TOLL_FREE_DIALING.setEnabled(g, false);
    PermissionName.LOCAL_DIALING.setEnabled(g, true);
    PermissionName.SIPX_VOICEMAIL.setEnabled(g, false);
    PermissionName.FREESWITH_VOICEMAIL.setEnabled(g, false);
    PermissionName.EXCHANGE_VOICEMAIL.setEnabled(g, true);

    user.addGroup(g);
    user.setUserName("goober");

    Permissions permissions = new Permissions();
    permissions.addUser(items, user, "sipx.sipfoundry.org");

    assertEquals(PERM_COUNT, items.size());
    assertEquals("sip:[email protected]", items.get(0).get("identity"));
    assertEquals("LocalDialing", items.get(0).get("permission"));

    assertEquals("sip:[email protected]", items.get(3).get("identity"));
    assertEquals("ExchangeUMVoicemailServer", items.get(3).get("permission"));

    assertEquals("sip:[email protected]", items.get(4).get("identity"));
    assertEquals("ExchangeUMVoicemailServer", items.get(4).get("permission"));
  }
Пример #2
0
 @Override
 public List<String> getPermissionNames() {
   List perms = Collections.singletonList(PermissionName.LOCAL_DIALING.getName());
   return perms;
 }