diff options
author | Julian Blake Kongslie <jblake@omgwallhack.org> | 2010-03-18 13:06:24 -0700 |
---|---|---|
committer | Julian Blake Kongslie <jblake@omgwallhack.org> | 2010-03-18 13:06:24 -0700 |
commit | 0df6b8d376c6cbac0ed3df910cdcc10c06bd3e18 (patch) | |
tree | b868e49eaba3592a9a26fd51aaa11c78ea127cb9 /usr/src/libpiny/lib/Piny/Group.pm | |
parent | 46f08c97433ed083bb479b00637c6aa5cb7b24d3 (diff) | |
download | piny-code-0df6b8d376c6cbac0ed3df910cdcc10c06bd3e18.tar.gz piny-code-0df6b8d376c6cbac0ed3df910cdcc10c06bd3e18.zip |
Add methods for managing group membership, and some more constraints.
Diffstat (limited to 'usr/src/libpiny/lib/Piny/Group.pm')
-rw-r--r-- | usr/src/libpiny/lib/Piny/Group.pm | 24 |
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 |