Improved groups creation and edition.
parent
8e03e83f8d
commit
3d49ca43be
|
@ -684,10 +684,18 @@ class Service
|
|||
|
||||
def create_user_and_group!
|
||||
Passwd.new("/etc/passwd", "/etc/group").tap do |passwd|
|
||||
return if passwd.get_user user_name
|
||||
if user = passwd.get_user user_name
|
||||
group = passwd.get_group user_name
|
||||
|
||||
passwd.add_user user_name,
|
||||
full_name: "Service[#{id}]"
|
||||
return if group.nil?
|
||||
|
||||
group.users = reverse_dependencies.map &.user_name
|
||||
|
||||
passwd.mod_group group
|
||||
else
|
||||
passwd.add_user user_name,
|
||||
full_name: "Service[#{id}]"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue