Skip to content

Commit

Permalink
Merge branch 'hooks' of http://github.com/speedy901990/web-svn into h…
Browse files Browse the repository at this point in the history
…ooks
  • Loading branch information
speedy committed May 20, 2013
2 parents e771bcb + e00d85a commit 7e9e859
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
17 changes: 17 additions & 0 deletions app/controllers/usertogroups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@ def new
def create
@usertogroup = Usertogroup.new(params[:usertogroup])
if @usertogroup.save
@configFile = File.open("config/apache_config/authz","w")
@allGroups = Group.all
@configFile.puts("[groups]\n")

@allGroups.each do |f|
@usersInGroup = Usertogroup.where("group_id = ?", f.id).all
if (@usersInGroup != nil)
@configFile.puts(f.group_name + " = ")

@usersInGroup.each do |g|
@usr = User.where("id = ?", g.user_id).first
@configFile.puts(@usr.email + ", ")
end
end
@configFile.puts("\n")
end
@configFile.close()
redirect_to root_url, :notice => "User to group relation created!"
else
render "new"
Expand Down
6 changes: 5 additions & 1 deletion config/apache_config/authz
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
[users]
[groups]
grupatestowa1 =
[email protected],
grupatestowa2 =
[email protected],

0 comments on commit 7e9e859

Please sign in to comment.