Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 3568f2f8

Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt

  • ID 3568f2f8cb1f21031ee5255f054c0431544c5607
  • Vorgänger 672e9658
  • Nachfolger 3e29b95e

RDBO: Setups der Auth*-Instanzen vereinheitlicht

Unterschiede anzeigen:

SL/DB/AuthClient.pm
1
# This file has been auto-generated only because it didn't exist.
2
# Feel free to modify it at will; it will not be overwritten automatically.
3

  
4 1
package SL::DB::AuthClient;
5 2

  
6 3
use strict;
......
8 5
use SL::DB::MetaSetup::AuthClient;
9 6
use SL::DB::Manager::AuthClient;
10 7

  
11
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
12
__PACKAGE__->meta->schema('auth');
13

  
14 8
__PACKAGE__->meta->add_relationship(
15 9
  users => {
16 10
    type      => 'many to many',
17
    map_class => 'SL::DB::AuthUserGroup',
11
    map_class => 'SL::DB::AuthClientUser',
18 12
    map_from  => 'client',
19 13
    map_to    => 'user',
20 14
  },
21 15
  groups => {
22 16
    type      => 'many to many',
23
    map_class => 'SL::DB::AuthUserGroup',
17
    map_class => 'SL::DB::AuthClientGroup',
24 18
    map_from  => 'client',
25 19
    map_to    => 'group',
26 20
  },
SL/DB/AuthClientGroup.pm
1
# This file has been auto-generated only because it didn't exist.
2
# Feel free to modify it at will; it will not be overwritten automatically.
3

  
4 1
package SL::DB::AuthClientGroup;
5 2

  
6 3
use strict;
7 4

  
8 5
use SL::DB::MetaSetup::AuthClientGroup;
9 6

  
10
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
11
__PACKAGE__->meta->schema('auth');
12

  
13 7
__PACKAGE__->meta->make_manager_class;
14 8

  
15 9
1;
SL/DB/AuthClientUser.pm
1
# This file has been auto-generated only because it didn't exist.
2
# Feel free to modify it at will; it will not be overwritten automatically.
3

  
4 1
package SL::DB::AuthClientUser;
5 2

  
6 3
use strict;
7 4

  
8 5
use SL::DB::MetaSetup::AuthClientUser;
9 6

  
10
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
11
__PACKAGE__->meta->schema('auth');
12

  
13 7
__PACKAGE__->meta->make_manager_class;
14 8

  
15 9
1;
SL/DB/AuthGroup.pm
1
# This file has been auto-generated only because it didn't exist.
2
# Feel free to modify it at will; it will not be overwritten automatically.
3

  
4 1
package SL::DB::AuthGroup;
5 2

  
6 3
use strict;
......
9 6
use SL::DB::Manager::AuthGroup;
10 7
use SL::DB::AuthGroupRight;
11 8

  
12
__PACKAGE__->meta->schema('auth');
13

  
14 9
__PACKAGE__->meta->add_relationship(
15 10
  users => {
16 11
    type      => 'many to many',
......
25 20
  },
26 21
  clients => {
27 22
    type      => 'many to many',
28
    map_class => 'SL::DB::AuthClient',
23
    map_class => 'SL::DB::AuthClientGroup',
29 24
    map_from  => 'group',
30 25
    map_to    => 'client',
31 26
  },
SL/DB/AuthGroupRight.pm
1
# This file has been auto-generated only because it didn't exist.
2
# Feel free to modify it at will; it will not be overwritten automatically.
3

  
4 1
package SL::DB::AuthGroupRight;
5 2

  
6 3
use strict;
7 4

  
8 5
use SL::DB::MetaSetup::AuthGroupRight;
9 6

  
10
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
11 7
__PACKAGE__->meta->make_manager_class;
12 8

  
13
__PACKAGE__->meta->schema('auth');
14
__PACKAGE__->meta->initialize;
15

  
16 9
1;
SL/DB/AuthUser.pm
1
# This file has been auto-generated only because it didn't exist.
2
# Feel free to modify it at will; it will not be overwritten automatically.
3

  
4 1
package SL::DB::AuthUser;
5 2

  
6 3
use strict;
......
9 6

  
10 7
use SL::DB::MetaSetup::AuthUser;
11 8
use SL::DB::Manager::AuthUser;
9
use SL::DB::AuthClient;
12 10
use SL::DB::AuthUserGroup;
13

  
14
__PACKAGE__->meta->schema('auth');
11
use SL::DB::Helper::Util;
15 12

  
16 13
__PACKAGE__->meta->add_relationship(
17 14
  groups => {
......
27 24
  },
28 25
  clients => {
29 26
    type      => 'many to many',
30
    map_class => 'SL::DB::AuthClient',
27
    map_class => 'SL::DB::AuthUserClient',
31 28
    map_from  => 'user',
32 29
    map_to    => 'client',
33 30
  },
......
35 32

  
36 33
__PACKAGE__->meta->initialize;
37 34

  
35
sub validate {
36
  my ($self) = @_;
37

  
38
  my @errors;
39
  push @errors, $::locale->text('The login is missing.')          if !$self->login;
40
  push @errors, $::locale->text('The login is not unique.')          if !SL::DB::Helper::Util::is_unique($self, 'login');
41
  push @errors, "chunky bacon";
42

  
43
  return @errors;
44
}
45

  
38 46
sub get_config_value {
39 47
  my ($self, $key) = @_;
40 48

  
SL/DB/AuthUserConfig.pm
1
# This file has been auto-generated only because it didn't exist.
2
# Feel free to modify it at will; it will not be overwritten automatically.
3

  
4 1
package SL::DB::AuthUserConfig;
5 2

  
6 3
use strict;
7 4

  
8 5
use SL::DB::MetaSetup::AuthUserConfig;
9 6

  
10
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
11 7
__PACKAGE__->meta->make_manager_class;
12 8

  
13
__PACKAGE__->meta->schema('auth');
14
__PACKAGE__->meta->initialize;
15

  
16 9
1;
SL/DB/AuthUserGroup.pm
1
# This file has been auto-generated only because it didn't exist.
2
# Feel free to modify it at will; it will not be overwritten automatically.
3

  
4 1
package SL::DB::AuthUserGroup;
5 2

  
6 3
use strict;
7 4

  
8 5
use SL::DB::MetaSetup::AuthUserGroup;
9 6

  
10
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
11 7
__PACKAGE__->meta->make_manager_class;
12 8

  
13
__PACKAGE__->meta->schema('auth');
14

  
15
__PACKAGE__->meta->add_foreign_keys(
16
  user => {
17
    class       => 'SL::DB::AuthUser',
18
    key_columns => { user_id => 'id' },
19
  },
20

  
21
  group => {
22
    class       => 'SL::DB::AuthGroup',
23
    key_columns => { group_id => 'id' },
24
  },
25
);
26

  
27
__PACKAGE__->meta->initialize;
28

  
29 9
1;
SL/DB/MetaSetup/AuthClient.pm
8 8

  
9 9
__PACKAGE__->meta->setup(
10 10
  table   => 'clients',
11
  schema  => 'auth',
11 12

  
12 13
  columns => [
13 14
    id         => { type => 'serial', not_null => 1 },
SL/DB/MetaSetup/AuthClientGroup.pm
8 8

  
9 9
__PACKAGE__->meta->setup(
10 10
  table   => 'clients_groups',
11
  schema  => 'auth',
11 12

  
12 13
  columns => [
13 14
    client_id => { type => 'integer', not_null => 1 },
SL/DB/MetaSetup/AuthClientUser.pm
8 8

  
9 9
__PACKAGE__->meta->setup(
10 10
  table   => 'clients_users',
11
  schema  => 'auth',
11 12

  
12 13
  columns => [
13 14
    client_id => { type => 'integer', not_null => 1 },
SL/DB/MetaSetup/AuthGroup.pm
8 8

  
9 9
__PACKAGE__->meta->setup(
10 10
  table   => 'group',
11
  schema  => 'auth',
11 12

  
12 13
  columns => [
13 14
    id          => { type => 'serial', not_null => 1 },
SL/DB/MetaSetup/AuthGroupRight.pm
8 8

  
9 9
__PACKAGE__->meta->setup(
10 10
  table   => 'group_rights',
11
  schema  => 'auth',
11 12

  
12 13
  columns => [
13 14
    group_id => { type => 'integer', not_null => 1 },
SL/DB/MetaSetup/AuthUser.pm
8 8

  
9 9
__PACKAGE__->meta->setup(
10 10
  table   => 'user',
11
  schema  => 'auth',
11 12

  
12 13
  columns => [
13 14
    id       => { type => 'serial', not_null => 1 },
SL/DB/MetaSetup/AuthUserConfig.pm
8 8

  
9 9
__PACKAGE__->meta->setup(
10 10
  table   => 'user_config',
11
  schema  => 'auth',
11 12

  
12 13
  columns => [
13 14
    user_id   => { type => 'integer', not_null => 1 },
SL/DB/MetaSetup/AuthUserGroup.pm
8 8

  
9 9
__PACKAGE__->meta->setup(
10 10
  table   => 'user_group',
11
  schema  => 'auth',
11 12

  
12 13
  columns => [
13 14
    user_id  => { type => 'integer', not_null => 1 },
......
15 16
  ],
16 17

  
17 18
  primary_key_columns => [ 'user_id', 'group_id' ],
19

  
20
  foreign_keys => [
21
    user => {
22
      class       => 'SL::DB::AuthUser',
23
      key_columns => { user_id => 'id' },
24
    },
25

  
26
    group => {
27
      class       => 'SL::DB::AuthGroup',
28
      key_columns => { group_id => 'id' },
29
    },
30
  ],
18 31
);
19 32

  
20 33
1;

Auch abrufbar als: Unified diff