New Rest API added to obtain a JID login time

GetUserInfo command has been expanded to obtain user login and logout times in addition to standard information. To obtain the information, send a POST request to http://xmpp.domain.net:8080/rest/adhoc/sess-man@xmpp.domain.net?api-key=test-api-key with the following:

<command>
  <node>get-user-info</node>
  <fields>
    <item>
      <var>accountjid</var>
      <value>user@xmpp.domain.net</value>
    </item>
    <item>
      <var>Show connected resources in table</var>
      <value>true</value>
    </item>
  </fields>
</command>
Configuration

The HTTP API privacy scipt is loaded automatically. DomainFilter is a default plugin loaded by Tigase on startup. This means there is very little you need to do to have this running. Again, you may define a custom API key to limit access using the following line in init.properties

http/rest/api-keys[s]=test_key
Usage

Setting privacy rules can be done by sending a POST request to the session manager using this address: http://localhost:8080/rest/sess-man@domain.com?api-key=test_key

<command>
  <node>user-domain-perm</node>
  <fields>
    <item>
      <var>jid</var>
      <value>user@domain.com</value>
    </item>
    <item>
      <var>fiteringPolicy</var>
      <value>CUSTOM</value>
    </item>
    <item>
      <var>filteringList</var>
      <value>
         1|allow|self;
         2|allow|jid|admin@test2.com;
         3|allow|jid|pubsub@test.com;
         4|deny|all;
      </value>
    </item>
  </fields>
</command>

Here all parameters are passed to be excuted by ad-hot command. Using the user-domain-perm node we were able to add jids to a CUSTOM filter. Here is a brief breakdown:

  • jid denotes which JID the settings will be applied too.
  • filteringPolicy - This uses a CUSTOM type list that allows for multi-item list of custom processing rules.
  • filteringLise - This is a multi-item list, semi-colon delimited, where each line denotes one item with a rule in this format: +order_number|policy|UID_type[|UID]:
  • order_number can be any integer, as long as no numbers repeat.
  • policy can either allow or deny.
  • UID_type is the User ID Type, can be jid, domain, or all.
  • UID is the user JID affected. If UID_type is set to all then this will be ignored.

These ad-hoc commands replicate settings found in Domain Based Packet Filtering in the admin guide. They may also be influenced by the --domain-filter-policy property of init.properties.