home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / share / system-tools-backends-2.0 / scripts / GroupsConfig.pm < prev    next >
Encoding:
Perl POD Document  |  2011-09-23  |  2.1 KB  |  83 lines

  1. #-*- Mode: perl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  
  3. # DBus object for the Groups list
  4. #
  5. # Copyright (C) 2005 Carlos Garnacho
  6. #
  7. # Authors: Carlos Garnacho Parro  <carlosg@gnome.org>
  8. #
  9. # This program is free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU Library General Public License as published
  11. # by the Free Software Foundation; either version 2 of the License, or
  12. # (at your option) any later version.
  13. #
  14. # This program is distributed in the hope that it will be useful,
  15. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. # GNU Library General Public License for more details.
  18. #
  19. # You should have received a copy of the GNU Library General Public License
  20. # along with this program; if not, write to the Free Software
  21. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
  22.  
  23. package GroupsConfig;
  24.  
  25. use base qw(StbObject);
  26. use Net::DBus::Exporter ($Utils::Backend::DBUS_PREFIX);
  27. use GroupConfig;
  28. use Users::Groups;
  29. use Users::Users;
  30.  
  31. my $OBJECT_NAME = "GroupsConfig2";
  32. my $OBJECT_PATH = "$Utils::Backend::DBUS_PATH/$OBJECT_NAME";
  33.  
  34. # array of groups, min gid, max gid
  35. my $format = [ [ "array", $GroupConfig::GROUP_FORMAT ], "uint32", "uint32" ];
  36.  
  37. sub new
  38. {
  39.   my $class = shift;
  40.   my $self  = $class->SUPER::new ($OBJECT_PATH, $OBJECT_NAME);
  41.  
  42.   bless $self, $class;
  43.  
  44. #  Utils::Monitor::monitor_files (&Users::Groups::get_files (),
  45. #                                 $self, $OBJECT_NAME, "changed");
  46.   return $self;
  47. }
  48.  
  49. dbus_method ("get", [], $format);
  50. dbus_method ("set", $format, []);
  51. #dbus_signal ("changed", []);
  52.  
  53. sub get
  54. {
  55.   my ($self) = @_;
  56.   my $groups, $logindefs;
  57.   $self->SUPER::reset_counter ();
  58.  
  59.   $groups = Users::Groups::get ();
  60.   $logindefs = &Users::Users::get_logindefs ();
  61.  
  62.   return ($groups, $$logindefs{"gmin"}, $$logindefs{"gmax"});
  63. }
  64.  
  65. sub set
  66. {
  67.   my ($self, $config) = @_;
  68.   $self->SUPER::reset_counter ();
  69.  
  70.   Users::Groups::set ($config);
  71. }
  72.  
  73. sub getFiles
  74. {
  75.   my ($self) = @_;
  76.  
  77.   return &Users::Groups::get_files ();
  78. }
  79.  
  80. my $config = GroupsConfig->new ();
  81.  
  82. 1;
  83.