shithub: werc

Download patch

ref: 902d9d88e618ff8e50262d22f8a0f78c5010dc25
parent: fc5b6f571e8bf3239a88e023b9f22a6470b19230
author: sl <[email protected]>
date: Sat Feb 28 08:27:16 EST 2009

Groups are now simply users with a /members file with one member per file.

--- a/bin/aux/addwuser.rc
+++ b/bin/aux/addwuser.rc
@@ -26,6 +26,8 @@
 echo $user_pass > etc/users/$user_name/password
 
 if(! ~ $#user_groups 0)
-    for(g in $user_groups)
-        echo $user_name >> etc/groups/$g
+    for(g in $user_groups) {
+        mkdir -p etc/users/$g
+        echo $user_name >> etc/users/$g/members
+    }
   
--- a/bin/werclib.rc
+++ b/bin/werclib.rc
@@ -29,8 +29,8 @@
     _status=$status
     if(! ~ $"_status '')
         _status=(Not logged in: $"_status)
-    if not if(! ~ $#* 0 && ! grep -s '^'^$logged_user^'$' etc/groups/$* etc/groups/admin)
-        _status=(User $logged_user not in groups $*)
+    if not if(! ~ $#* 0 && ! ~ $logged_user $* && ! grep -s '^'^$logged_user^'$' etc/users/$*/members etc/users/admin/members >[2]/dev/null)
+        _status=(User $logged_user not in: $*)
     status=$_status
 }