From 91fa2bb9a30fd38e6c7255d23ee1e5500ac3ce71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrej=20Rama=C5=A1euski?= <andrej@x2.cz> Date: Sat, 5 Feb 2022 18:06:55 +0100 Subject: [PATCH] Datovy model pro ACL --- lib/CF/Schema/Result/EventACL.pm | 10 ++++++-- lib/CF/Schema/Result/EventACLSubject.pm | 34 +++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 lib/CF/Schema/Result/EventACLSubject.pm diff --git a/lib/CF/Schema/Result/EventACL.pm b/lib/CF/Schema/Result/EventACL.pm index 8dc9dcf..3702eb9 100644 --- a/lib/CF/Schema/Result/EventACL.pm +++ b/lib/CF/Schema/Result/EventACL.pm @@ -18,8 +18,7 @@ __PACKAGE__->add_columns( }, qw( event_id - subject_class - subject + subject_id role ), ); @@ -31,4 +30,11 @@ __PACKAGE__->belongs_to( }, ); +__PACKAGE__->belongs_to( + subject => 'CF::Schema::Result::EventACLSubject', + { + 'foreign.id' => 'self.subject_id', + }, +); + 1; diff --git a/lib/CF/Schema/Result/EventACLSubject.pm b/lib/CF/Schema/Result/EventACLSubject.pm new file mode 100644 index 0000000..3b7f8ca --- /dev/null +++ b/lib/CF/Schema/Result/EventACLSubject.pm @@ -0,0 +1,34 @@ +package CF::Schema::Result::EventACLSubject; + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +our $VERSION = 1; + +__PACKAGE__->table('events_acl_subjects'); + +__PACKAGE__->add_columns( + id => { + data_type => 'integer', + is_auto_increment => 1, + is_nullable => 0, + sequence => 'uid_seq' + }, + qw( + updated + class + key + name + ), +); + +__PACKAGE__->set_primary_key('id'); + +__PACKAGE__->add_unique_constraint( + class_key => [qw(class key)] +); + +1; + -- GitLab