首页 > 解决方案 > Get list of users who have logged into Octopus in the last 6 months

问题描述

I was wondering if there is a way to find out what users have logged into Octopus Deploy in the last 3 months. I am able get a list of users in Octopus by using an REST API call: Invoke-RestMethod "$OctopusUrl/api/users?take=500" -Headers $header. I cant see an API call to get user login activity. Just want to ask if anyone knows a way to do this?

标签: powershellauthenticationoctopus-deploy

解决方案


I can potentially see two ways of doing this

1) Use the api/events endpoint. This will allow you to provide a range of dates using the from and to parameters. You would then have to enumerate all records and pull out the distinct users you come across - you probably want to narrow this by ensuring the account authenticated with a cookie "IdentityEstablishedWith": "Session cookie"

2) Use the results from the api/users to call the api/events endpoint, with the date range and the specific user e.g. ?users=Users-1. Here, you only need to check if you get more than 1 result with the "IdentityEstablishedWith": "Session cookie" field set correctly

Hope this helps


推荐阅读