Python Forum

Full Version: Help with rhel 7 that no longer has ConsoleKit
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I am not really proficient in Python, but do understand most of it. I am trying to get old gnome nanny to work with rhel 7 (centOS 7.2). 7 has got rid of ConsoleKit. Does anybody know of way to get all sessions for a particular user?

Here is the old code for this using ConsoleKit:
Code: Select all
            if app_id == SESSION_APPID :
                try:
                    d = dbus.SystemBus()
                    manager = dbus.Interface(d.get_object("org.freedesktop.ConsoleKit", "/org/freedesktop/ConsoleKit/Manager"), 
                                             "org.freedesktop.ConsoleKit.Manager")
                    sessions = manager.GetSessionsForUnixUser(int(user_id))
                    for session_name in sessions :
                        session = dbus.Interface(d.get_object("org.freedesktop.ConsoleKit", session_name),
                                                 "org.freedesktop.ConsoleKit.Session")
                        x11_display = session.GetX11Display()
                        if x11_display == "":
                            continue
                        self.quarterback.subtract_time(user_id, app_id)
                        break
                except:
                    print "Crash Chrono __update_cb"
I think I have to use login1 instead of ConsoleKit but I do not know or have I been to find how get all sessions for particular user. The part:
Code: Select all
sessions = manager.GetSessionsForUnixUser(int(user_id))
is where I am failing now and I can't seem to find a replacement for this call.

I am wanting to use nanny because it is the only one I been able to use in the past to block certain users from access to the internet. I am on CentOS 7.2 using xrdp as a terminal server where every user has their own desktop using gnome classic. All the others I have looked seem to do system wide filtering and not individual users.

I am not trying to filter anything, just lock out some users, but not all users.

Any help would be appreciated.

Thanks,
Ron
Since this is more about RHEL than Python, you might find better (more specialized) help in a RHEL forum. In fact, since it's an enterprise situation you should be able to contact them for support.