Improved groups creation and edition.

master
Luka Vandervelden 2020-01-04 09:08:55 +01:00
parent 8e03e83f8d
commit 3d49ca43be
1 changed files with 11 additions and 3 deletions

View File

@ -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