Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a5ba22d2

Von Moritz Bunkus vor fast 14 Jahren hinzugefügt

  • ID a5ba22d29e683629d731fc0bfdfb72719e59a0b9
  • Vorgänger a93b3b64
  • Nachfolger 5916be6b

RDBO-Models für die Klassen im auth-Schema

Unterschiede anzeigen:

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
package SL::DB::AuthGroup;
5

  
6
use strict;
7

  
8
use SL::DB::MetaSetup::AuthGroup;
9
use SL::DB::AuthGroupRight;
10

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

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

  
16
__PACKAGE__->meta->add_relationship(
17
  users => {
18
    type      => 'many to many',
19
    map_class => 'SL::DB::AuthUserGroup',
20
    map_from  => 'group',
21
    map_to    => 'user',
22
  },
23
  rights => {
24
    type       => 'one to many',
25
    class      => 'SL::DB::AuthGroupRight',
26
    column_map => { id => 'group_id' },
27
  },
28
);
29

  
30
__PACKAGE__->meta->initialize;
31

  
32
1;
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
package SL::DB::AuthGroupRight;
5

  
6
use strict;
7

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

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

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

  
16
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
package SL::DB::AuthUser;
5

  
6
use strict;
7

  
8
use SL::DB::MetaSetup::AuthUser;
9
use SL::DB::AuthUserGroup;
10

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

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

  
16
__PACKAGE__->meta->add_relationship(
17
  groups => {
18
    type      => 'many to many',
19
    map_class => 'SL::DB::AuthUserGroup',
20
    map_from  => 'user',
21
    map_to    => 'group',
22
  },
23
  configs => {
24
    type       => 'one to many',
25
    class      => 'SL::DB::AuthUserConfig',
26
    column_map => { id => 'user_id' },
27
  },
28
);
29

  
30
__PACKAGE__->meta->initialize;
31

  
32
1;
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
package SL::DB::AuthUserConfig;
5

  
6
use strict;
7

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

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

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

  
16
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
package SL::DB::AuthUserGroup;
5

  
6
use strict;
7

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

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

  
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
1;
SL/DB/Helper/Mappings.pm
26 26
my %lxoffice_package_names = (
27 27
  acc_trans                      => 'acc_transaction',
28 28
  audittrail                     => 'audit_trail',
29
  auth_group                     => 'auth_groups',
30
  auth_group_right               => 'auth_group_rights',
31
  auth_user                      => 'auth_users',
32
  auth_user_config               => 'auth_user_configs',
33
  auth_user_group                => 'auth_user_groups',
29 34
  ar                             => 'invoice',
30 35
  ap                             => 'purchase_invoice',
31 36
  background_jobs                => 'background_job',
SL/DB/Helpers/ALLAuth.pm
1
package SL::DB::Helpers::ALLAuth;
2

  
3
use strict;
4

  
5
use SL::DB::AuthGroup;
6
use SL::DB::AuthGroupRight;
7
use SL::DB::AuthUserConfig;
8
use SL::DB::AuthUser;
9

  
10
1;
11

  
12
__END__
13

  
14
=pod
15

  
16
=head1 NAME
17

  
18
SL::DB::Helpers::ALLAuth: Dependency-only package for all SL::DB::Auth* modules
19

  
20
=head1 SYNOPSIS
21

  
22
  use SL::DB::Helpers::ALLAuth;
23

  
24
=head1 DESCRIPTION
25

  
26
This module depends on all modules in SL/DB/Auth*.pm for the
27
convenience of being able to write a simple \C<use
28
SL::DB::Helpers::ALLAuth> and having everything loaded. This is
29
supposed to be used only in the Lx-Office console. Normal modules
30
should C<use> only the modules they actually need.
31

  
32
=head1 AUTHOR
33

  
34
Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>
35

  
36
=cut
SL/DB/MetaSetup/AuthGroup.pm
1
# This file has been auto-generated. Do not modify it; it will be overwritten
2
# by rose_auto_create_model.pl automatically.
3
package SL::DB::AuthGroup;
4

  
5
use strict;
6

  
7
use base qw(SL::DB::Object);
8

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

  
12
  columns => [
13
    id          => { type => 'serial', not_null => 1 },
14
    name        => { type => 'text', not_null => 1 },
15
    description => { type => 'text' },
16
  ],
17

  
18
  primary_key_columns => [ 'id' ],
19

  
20
  unique_key => [ 'name' ],
21
);
22

  
23
1;
24
;
SL/DB/MetaSetup/AuthGroupRight.pm
1
# This file has been auto-generated. Do not modify it; it will be overwritten
2
# by rose_auto_create_model.pl automatically.
3
package SL::DB::AuthGroupRight;
4

  
5
use strict;
6

  
7
use base qw(SL::DB::Object);
8

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

  
12
  columns => [
13
    group_id => { type => 'integer', not_null => 1 },
14
    right    => { type => 'text', not_null => 1 },
15
    granted  => { type => 'boolean', not_null => 1 },
16
  ],
17

  
18
  primary_key_columns => [ 'group_id', 'right' ],
19
);
20

  
21
1;
22
;
SL/DB/MetaSetup/AuthUser.pm
1
# This file has been auto-generated. Do not modify it; it will be overwritten
2
# by rose_auto_create_model.pl automatically.
3
package SL::DB::AuthUser;
4

  
5
use strict;
6

  
7
use base qw(SL::DB::Object);
8

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

  
12
  columns => [
13
    id       => { type => 'serial', not_null => 1 },
14
    login    => { type => 'text', not_null => 1 },
15
    password => { type => 'text' },
16
  ],
17

  
18
  primary_key_columns => [ 'id' ],
19

  
20
  unique_key => [ 'login' ],
21
);
22

  
23
1;
24
;
SL/DB/MetaSetup/AuthUserConfig.pm
1
# This file has been auto-generated. Do not modify it; it will be overwritten
2
# by rose_auto_create_model.pl automatically.
3
package SL::DB::AuthUserConfig;
4

  
5
use strict;
6

  
7
use base qw(SL::DB::Object);
8

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

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

  
18
  primary_key_columns => [ 'user_id', 'cfg_key' ],
19
);
20

  
21
1;
22
;
SL/DB/MetaSetup/AuthUserGroup.pm
1
# This file has been auto-generated. Do not modify it; it will be overwritten
2
# by rose_auto_create_model.pl automatically.
3
package SL::DB::AuthUserGroup;
4

  
5
use strict;
6

  
7
use base qw(SL::DB::Object);
8

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

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

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

  
20
1;
21
;
scripts/rose_auto_create_model.pl
71 71
sub process_table {
72 72
  my @spec       =  split(/=/, shift, 2);
73 73
  my $table      =  $spec[0];
74
  my $schema     = '';
75
  ($schema, $table) = split(m/\./, $table) if $table =~ m/\./;
74 76
  my $package    =  ucfirst($spec[1] || $spec[0]);
75 77
  $package       =~ s/_+(.)/uc($1)/ge;
76 78
  my $meta_file  =  "${meta_path}/${package}.pm";
77 79
  my $file       =  "SL/DB/${package}.pm";
78 80

  
81
  $schema        = <<CODE if $schema;
82
    __PACKAGE__->meta->schema('$schema');
83
CODE
84

  
79 85
  my $definition =  eval <<CODE;
80 86
    package SL::DB::AUTO::$package;
81 87
    use SL::DB::Object;
82 88
    use base qw(SL::DB::Object);
83 89

  
84 90
    __PACKAGE__->meta->table('$table');
91
$schema
85 92
    __PACKAGE__->meta->auto_initialize;
86 93

  
87 94
    __PACKAGE__->meta->perl_class_definition(indent => 2); # , braces => 'bsd'

Auch abrufbar als: Unified diff