create a period of active login in portal

738
2
09-09-2021 02:40 AM
Status: Open
VMASK
by
Emerging Contributor

we know that some user will have a period of work In our organisation.

It would be a great help to have the possibility of creating  a user in portal and to set up a period of activity

automatically the user login will be desactivated before and after this period

2 Comments
jcarlson

I like this idea. We have temporary users whose access will need revoking at some future known date.

For now, if you are comfortable with the Python API, you could schedule a task to do this, but it would be a neat built-in function.

HenryLindemann

Hi @VMASK

It is not available out of the box, but easy to achieve in a script using python

https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#user

 

‘’’

import arcgis
import datetime

con = arcgis.gos.GIS("https://service.url", "admin_user", "admin_psw", verify_cert=True)

users = ["username_a", "username_b", "username_c"]

while True:
    hr = datetime.datetime.now().hour
    if hr > 6 and hr < 18:
        for user in users:
            pass
            selected_user = arcgis.gis.User(con, user)
            selected_user.disable()
    else:
        for user in users:
            pass
            selected_user = arcgis.gis.User(con, user)
            selected_user.enable()

    time.sleep(60) #seconds

 

‘’’