Expire date for user accounts

Is it possible to define an expire date for a user account?

I’ve never seen it, in either the web-ui for creating users or documented in the Users API.

Is there any (other) way to automatically block or deactivate users after a specific time period?

I know you can expire their role to a group/project but not the user itself.

Is it possible (and how) to implement such feature in gitlab?

When you add a user to a group or a project, just put in an expiration date.


Unfortunately, this doesn’t really help in our case. We want to sort out accounts which are no longer active/needed. At our department staff/students stay for a certain time and leave. Our hosted Gitlab is maintained by several admins from various groups inside the department and tracking inactive accounts is not so easy.

I realise the suggested feature doesn’t completely solve your problem, but it seems to me it could get you closer if combined with something like the feature discussed in

that thread even contains a script for automating this (I haven’t tried that script, so I can’t say whether it’s safe).

We have tied having an unblocked GitLab account to having a defined user in our configuration management (in a way that allows people to get GitLab accounts without anything else), and have scripts that uses the Users API to create/block accounts. Maybe you can also tie it to something that already happens?

I hope I understood you correctly, but you are saying we should write a script whether a user has been active e.g. in the last 6 month and if not we should automatically block it?

I’m saying that such a script (possibly combined with the feature @gregorip pointed at - and there is a script on the linked page, so you might be able to get by modifying that rather than write a new) will (while being a workaround) bring you closer to your goal.

Thanks for your help! We’ll consider your suggestion!