summaryrefslogtreecommitdiff
path: root/usr/src/libpiny/lib/Piny/Group.pm
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/libpiny/lib/Piny/Group.pm')
-rw-r--r--usr/src/libpiny/lib/Piny/Group.pm24
1 files changed, 24 insertions, 0 deletions
diff --git a/usr/src/libpiny/lib/Piny/Group.pm b/usr/src/libpiny/lib/Piny/Group.pm
index 4b957a7..c1df42d 100644
--- a/usr/src/libpiny/lib/Piny/Group.pm
+++ b/usr/src/libpiny/lib/Piny/Group.pm
@@ -35,6 +35,30 @@ has 'members' =>
, init_arg => undef
);
+# Public methods
+
+sub add_member {
+ my ( $s, @users ) = @_;
+
+ foreach my $user ( @users ) {
+ system( "adduser", $user->username( ), $s->groupname( ) );
+ $user->clear_groups( );
+ };
+
+ $s->clear_members( );
+};
+
+sub remove_member {
+ my ( $s, @users ) = @_;
+
+ foreach my $user ( @users ) {
+ system( "deluser", $user->username( ), $s->groupname( ) );
+ $user->clear_groups( );
+ };
+
+ $s->clear_members( );
+};
+
# Builder methods
# If constructed with just one argument, then