WebshopApi: neues Recht webshop_api_rights
authorWerner Hahn <wh@futureworldsearch.net>
Fri, 22 Sep 2017 00:34:49 +0000 (02:34 +0200)
committerWerner Hahn <wh@futureworldsearch.net>
Tue, 26 Sep 2017 10:25:02 +0000 (12:25 +0200)
sql/Pg-upgrade2-auth/webshop_api_rights.pl [new file with mode: 0644]

diff --git a/sql/Pg-upgrade2-auth/webshop_api_rights.pl b/sql/Pg-upgrade2-auth/webshop_api_rights.pl
new file mode 100644 (file)
index 0000000..6c01905
--- /dev/null
@@ -0,0 +1,32 @@
+# @tag: webshop_api_rights
+# @description: Setzt die Rechte Shopconfig, Shopbestellungen, Shopartikel, per Default erlaubt
+# @depends: release_3_5_0
+package SL::DBUpgrade2::Auth::webshop_api_rights;
+
+use strict;
+use utf8;
+
+use parent qw(SL::DBUpgrade2::Base);
+
+use SL::DBUtils;
+
+sub run {
+  my ($self) = @_;
+
+  $self->db_query("INSERT INTO auth.master_rights (position, name, description) VALUES ( 550,  'shop_part_edit',   'Create and edit shopparts')");
+  $self->db_query("INSERT INTO auth.master_rights (position, name, description) VALUES ( 950,  'shop_order',       'Get shoporders')");
+  $self->db_query("INSERT INTO auth.master_rights (position, name, description) VALUES ( 4300, 'edit_shop_config', 'Create and edit webshops')");
+
+  my $groups = $main::auth->read_groups();
+
+  foreach my $group (values %{$groups}) {
+    $group->{rights}->{shop_part_edit}   = 1;
+    $group->{rights}->{shop_order}       = 1;
+    $group->{rights}->{edit_shop_config} = 1;
+    $main::auth->save_group($group);
+  }
+
+  return 1;
+} # end run
+
+1;