Improved groups creation and edition.
parent
8e03e83f8d
commit
3d49ca43be
|
@ -684,12 +684,20 @@ 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
|
||||
|
||||
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
|
||||
|
||||
def remove_user_and_group!
|
||||
Passwd.new("/etc/passwd", "/etc/group").tap do |passwd|
|
||||
|
|
Loading…
Reference in New Issue