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 / UserConfig.pm < prev    next >
Encoding:
Perl POD Document  |  2011-09-23  |  2.3 KB  |  92 lines

  1. #-*- Mode: perl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  
  3. # DBus object for a single user configuration
  4. #
  5. # Copyright (C) 2007 Carlos Garnacho
  6. #
  7. # Authors: Carlos Garnacho Parro  <carlosg@gnome.org>,
  8. #          Milan Bouchet-Valat <nalimilan@club.fr>.
  9. #
  10. # This program is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU Library General Public License as published
  12. # by the Free Software Foundation; either version 2 of the License, or
  13. # (at your option) any later version.
  14. #
  15. # This program is distributed in the hope that it will be useful,
  16. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18. # GNU Library General Public License for more details.
  19. #
  20. # You should have received a copy of the GNU Library General Public License
  21. # along with this program; if not, write to the Free Software
  22. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
  23.  
  24. package UserConfig;
  25.  
  26. use base qw(StbObject);
  27. use Net::DBus::Exporter ($Utils::Backend::DBUS_PREFIX);
  28. use Users::Users;
  29.  
  30. my $OBJECT_NAME = "UserConfig2";
  31. my $OBJECT_PATH = "$Utils::Backend::DBUS_PATH/$OBJECT_NAME";
  32.  
  33. # base user struct, also used in UsersConfig
  34. # variables: login, password, UID, main group GID, GECOS fields, home, shell,
  35. # password flags, encrypted home, home dir flags, locale, location, face
  36. our $USER_FORMAT = [ "struct", "string", "string", "uint32", "uint32", [ "array", "string" ], "string", "string",
  37.                      "int32", "bool", "int32", "string", "string", "string" ];
  38.  
  39. sub new
  40. {
  41.   my $class = shift;
  42.   my $self  = $class->SUPER::new ($OBJECT_PATH, $OBJECT_NAME);
  43.  
  44.   bless $self, $class;
  45.  
  46.   return $self;
  47. }
  48.  
  49. dbus_method ("get", [ "string" ], [ $USER_FORMAT ]);
  50. dbus_method ("set", [ $USER_FORMAT ], []);
  51. dbus_method ("add", [ $USER_FORMAT ], [ $USER_FORMAT ]);
  52. dbus_method ("del", [ $USER_FORMAT ], []);
  53.  
  54. sub get
  55. {
  56.   my ($self, $login) = @_;
  57.  
  58.   return Users::Users::get_user ($login);
  59. }
  60.  
  61. sub set
  62. {
  63.   my ($self, @config) = @_;
  64.  
  65.   Users::Users::set_user (@config);
  66. }
  67.  
  68. sub add
  69. {
  70.   my ($self, @config) = @_;
  71.  
  72.   return Users::Users::add_user (@config);
  73. }
  74.  
  75. sub del
  76. {
  77.   my ($self, @config) = @_;
  78.  
  79.   Users::Users::del_user (@config);
  80. }
  81.  
  82. sub getFiles
  83. {
  84.   my ($self) = @_;
  85.  
  86.   return Users::Users::get_files ();
  87. }
  88.  
  89. my $config = UserConfig->new ();
  90.  
  91. 1;
  92.