summaryrefslogtreecommitdiff
path: root/app/controllers/group_permissions_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/group_permissions_controller.rb')
-rw-r--r--app/controllers/group_permissions_controller.rb48
1 files changed, 48 insertions, 0 deletions
diff --git a/app/controllers/group_permissions_controller.rb b/app/controllers/group_permissions_controller.rb
new file mode 100644
index 0000000..3abdc51
--- /dev/null
+++ b/app/controllers/group_permissions_controller.rb
@@ -0,0 +1,48 @@
+class GroupPermissionsController < ApplicationController
+ load_and_authorize_resource :group
+ load_and_authorize_resource :group_permission, :through => [:group]
+
+ def index
+ end
+
+ def show
+ end
+
+ def new
+ end
+
+ def create
+ @group_permission = @group.group_permissions.new(params[:group_permission])
+ if @group_permission.save
+ redirect_to action: "index", :notice => t('group_permissions.controller.successfuly_created')
+ else
+ render :new
+ end
+ end
+
+ def edit
+ end
+
+ def update
+ if @group_permission.update_attributes(params[:group_permission])
+ redirect_to action: "index", :notice => t('group_permissions.controller.successfuly_updated')
+ else
+ render :edit
+ end
+ end
+
+ def destroy
+ @group_permission.destroy
+ redirect_to action: "index", :notice => t('group_permissions.controller.successfuly_destroyed')
+ end
+
+ private
+ def spread_breadcrumbs
+ add_breadcrumb t("groups.index.page_title"), groups_path
+ add_breadcrumb @group, group_path(@group)
+ add_breadcrumb t("group_permissions.index.page_title"), group_group_permissions_path(@group)
+ if @group_permission && !@group_permission.new_record?
+ add_breadcrumb @group_permission, group_group_permission_path(@group, @group_permission)
+ end
+ end
+end