@mwarmoeskerken opened this Issue on September 23rd 2016

In order to better manage user-accounts for Piwik it would be great if the lastSeen variable was added as a new column that is returned with the API method UsersManager.getUsers. We currently use these API-calls to export the list of users and manage access to Piwik via an external tool.

@mattab commented on September 26th 2016 Owner

Sounds good, feel free to submit a pull request!

@Morerice commented on September 21st 2017 Contributor

@mwarmoeskerken Is this still open?

@mattab commented on September 21st 2017 Owner

yes as you can see here
yes as you can see here

@Morerice commented on September 22nd 2017 Contributor

@mattab Just to confirm. Does the $userName argument in LastSeenTimeLogger::getLastSeenTimeForUser refer to the user login?

` /**

  • Returns the time a user was last seen or false if the user has never logged in. */

    public static function getLastSeenTimeForUser($userName)
    {
    $optionName = self::OPTION_PREFIX . $userName;
    return Option::get($optionName);
    }`

@mattab commented on September 22nd 2017 Owner

Hi @Morerice if you will create a pull request you need to make sure you understand this and test it. Yes, it is the user login.

@Morerice commented on September 23rd 2017 Contributor

Thanks @mattab. That is exactly the reason why I asked the question. I would assume that the requested last_seen parameter is to be returned as a UNIX timestamp. All UserManager tests are still correct and here is the xml received when I requested the updated getUsers function:


<result>
    <row>
        <login>anonymous</login>
        <password />
        <alias>anonymous</alias>
        <email>anonymous<a class='mention' href='https://github.com/example'>@example</a>.org</email>
        <superuser_access>0</superuser_access>
        <date_registered>2017-09-21 07:04:42</date_registered>
    </row>
    <row>
        <login>super_piwik</login>
        <password>XXXXXXXXX</password>
        <alias>super_piwik</alias>
        <email>XXXXXXXXXX</email>
        <superuser_access>1</superuser_access>
        <date_registered>2017-09-21 07:06:22</date_registered>
        <last_seen>1506156455</last_seen>
    </row>
</result>
@mattab commented on September 24th 2017 Owner

Hi @Morerice
To keep it consistent let's name it date_last_seen and make it a date time field like date_registered

Powered by GitHub Issue Mirror