Python Forum
Help with rhel 7 that no longer has ConsoleKit
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with rhel 7 that no longer has ConsoleKit
#1
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
Reply
#2
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Beginner: Code not work when longer list raiviscoding 2 763 May-19-2023, 11:19 AM
Last Post: deanhystad
  a longer docstring Skaperen 8 1,591 Aug-25-2022, 11:21 PM
Last Post: Skaperen
  pip3 v21.1.2 SSL Error on RHEL 7 malibu 0 3,067 Jun-01-2021, 03:17 PM
Last Post: malibu
  IDLE editing window no longer works chris1 2 2,156 Feb-06-2021, 07:59 AM
Last Post: chris1
  Code no longer working yk303 14 9,947 Dec-21-2020, 10:58 PM
Last Post: bowlofred
  ReferenceError: weakly-referenced object no longer exists MrBitPythoner 17 11,262 Dec-14-2020, 07:34 PM
Last Post: buran
  Python zeep offline installation on RHEL akinmhmt 0 1,963 Mar-26-2020, 09:04 AM
Last Post: akinmhmt
  How do I install Python 3.8.1 in a RHEL 8 UBI container? DevLinuxNC 1 3,520 Jan-08-2020, 09:37 PM
Last Post: Clunk_Head
  My code is taking longer time to give result rajeshwin 4 3,254 Feb-20-2019, 08:18 PM
Last Post: ichabod801
  Catching exceptions in embedded code no longer works on 3.7.2? FFMG 5 3,312 Feb-02-2019, 10:15 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020