Revision a5ba22d2
Von Moritz Bunkus vor etwa 14 Jahren hinzugefügt
SL/DB/AuthGroup.pm | ||
---|---|---|
# This file has been auto-generated only because it didn't exist.
|
||
# Feel free to modify it at will; it will not be overwritten automatically.
|
||
|
||
package SL::DB::AuthGroup;
|
||
|
||
use strict;
|
||
|
||
use SL::DB::MetaSetup::AuthGroup;
|
||
use SL::DB::AuthGroupRight;
|
||
|
||
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
|
||
__PACKAGE__->meta->make_manager_class;
|
||
|
||
__PACKAGE__->meta->schema('auth');
|
||
|
||
__PACKAGE__->meta->add_relationship(
|
||
users => {
|
||
type => 'many to many',
|
||
map_class => 'SL::DB::AuthUserGroup',
|
||
map_from => 'group',
|
||
map_to => 'user',
|
||
},
|
||
rights => {
|
||
type => 'one to many',
|
||
class => 'SL::DB::AuthGroupRight',
|
||
column_map => { id => 'group_id' },
|
||
},
|
||
);
|
||
|
||
__PACKAGE__->meta->initialize;
|
||
|
||
1;
|
SL/DB/AuthGroupRight.pm | ||
---|---|---|
# This file has been auto-generated only because it didn't exist.
|
||
# Feel free to modify it at will; it will not be overwritten automatically.
|
||
|
||
package SL::DB::AuthGroupRight;
|
||
|
||
use strict;
|
||
|
||
use SL::DB::MetaSetup::AuthGroupRight;
|
||
|
||
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
|
||
__PACKAGE__->meta->make_manager_class;
|
||
|
||
__PACKAGE__->meta->schema('auth');
|
||
__PACKAGE__->meta->initialize;
|
||
|
||
1;
|
SL/DB/AuthUser.pm | ||
---|---|---|
# This file has been auto-generated only because it didn't exist.
|
||
# Feel free to modify it at will; it will not be overwritten automatically.
|
||
|
||
package SL::DB::AuthUser;
|
||
|
||
use strict;
|
||
|
||
use SL::DB::MetaSetup::AuthUser;
|
||
use SL::DB::AuthUserGroup;
|
||
|
||
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
|
||
__PACKAGE__->meta->make_manager_class;
|
||
|
||
__PACKAGE__->meta->schema('auth');
|
||
|
||
__PACKAGE__->meta->add_relationship(
|
||
groups => {
|
||
type => 'many to many',
|
||
map_class => 'SL::DB::AuthUserGroup',
|
||
map_from => 'user',
|
||
map_to => 'group',
|
||
},
|
||
configs => {
|
||
type => 'one to many',
|
||
class => 'SL::DB::AuthUserConfig',
|
||
column_map => { id => 'user_id' },
|
||
},
|
||
);
|
||
|
||
__PACKAGE__->meta->initialize;
|
||
|
||
1;
|
SL/DB/AuthUserConfig.pm | ||
---|---|---|
# This file has been auto-generated only because it didn't exist.
|
||
# Feel free to modify it at will; it will not be overwritten automatically.
|
||
|
||
package SL::DB::AuthUserConfig;
|
||
|
||
use strict;
|
||
|
||
use SL::DB::MetaSetup::AuthUserConfig;
|
||
|
||
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
|
||
__PACKAGE__->meta->make_manager_class;
|
||
|
||
__PACKAGE__->meta->schema('auth');
|
||
__PACKAGE__->meta->initialize;
|
||
|
||
1;
|
SL/DB/AuthUserGroup.pm | ||
---|---|---|
# This file has been auto-generated only because it didn't exist.
|
||
# Feel free to modify it at will; it will not be overwritten automatically.
|
||
|
||
package SL::DB::AuthUserGroup;
|
||
|
||
use strict;
|
||
|
||
use SL::DB::MetaSetup::AuthUserGroup;
|
||
|
||
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
|
||
__PACKAGE__->meta->make_manager_class;
|
||
|
||
__PACKAGE__->meta->schema('auth');
|
||
|
||
__PACKAGE__->meta->add_foreign_keys(
|
||
user => {
|
||
class => 'SL::DB::AuthUser',
|
||
key_columns => { user_id => 'id' },
|
||
},
|
||
|
||
group => {
|
||
class => 'SL::DB::AuthGroup',
|
||
key_columns => { group_id => 'id' },
|
||
},
|
||
);
|
||
|
||
__PACKAGE__->meta->initialize;
|
||
|
||
1;
|
SL/DB/Helper/Mappings.pm | ||
---|---|---|
my %lxoffice_package_names = (
|
||
acc_trans => 'acc_transaction',
|
||
audittrail => 'audit_trail',
|
||
auth_group => 'auth_groups',
|
||
auth_group_right => 'auth_group_rights',
|
||
auth_user => 'auth_users',
|
||
auth_user_config => 'auth_user_configs',
|
||
auth_user_group => 'auth_user_groups',
|
||
ar => 'invoice',
|
||
ap => 'purchase_invoice',
|
||
background_jobs => 'background_job',
|
SL/DB/Helpers/ALLAuth.pm | ||
---|---|---|
package SL::DB::Helpers::ALLAuth;
|
||
|
||
use strict;
|
||
|
||
use SL::DB::AuthGroup;
|
||
use SL::DB::AuthGroupRight;
|
||
use SL::DB::AuthUserConfig;
|
||
use SL::DB::AuthUser;
|
||
|
||
1;
|
||
|
||
__END__
|
||
|
||
=pod
|
||
|
||
=head1 NAME
|
||
|
||
SL::DB::Helpers::ALLAuth: Dependency-only package for all SL::DB::Auth* modules
|
||
|
||
=head1 SYNOPSIS
|
||
|
||
use SL::DB::Helpers::ALLAuth;
|
||
|
||
=head1 DESCRIPTION
|
||
|
||
This module depends on all modules in SL/DB/Auth*.pm for the
|
||
convenience of being able to write a simple \C<use
|
||
SL::DB::Helpers::ALLAuth> and having everything loaded. This is
|
||
supposed to be used only in the Lx-Office console. Normal modules
|
||
should C<use> only the modules they actually need.
|
||
|
||
=head1 AUTHOR
|
||
|
||
Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>
|
||
|
||
=cut
|
SL/DB/MetaSetup/AuthGroup.pm | ||
---|---|---|
# This file has been auto-generated. Do not modify it; it will be overwritten
|
||
# by rose_auto_create_model.pl automatically.
|
||
package SL::DB::AuthGroup;
|
||
|
||
use strict;
|
||
|
||
use base qw(SL::DB::Object);
|
||
|
||
__PACKAGE__->meta->setup(
|
||
table => 'group',
|
||
|
||
columns => [
|
||
id => { type => 'serial', not_null => 1 },
|
||
name => { type => 'text', not_null => 1 },
|
||
description => { type => 'text' },
|
||
],
|
||
|
||
primary_key_columns => [ 'id' ],
|
||
|
||
unique_key => [ 'name' ],
|
||
);
|
||
|
||
1;
|
||
;
|
SL/DB/MetaSetup/AuthGroupRight.pm | ||
---|---|---|
# This file has been auto-generated. Do not modify it; it will be overwritten
|
||
# by rose_auto_create_model.pl automatically.
|
||
package SL::DB::AuthGroupRight;
|
||
|
||
use strict;
|
||
|
||
use base qw(SL::DB::Object);
|
||
|
||
__PACKAGE__->meta->setup(
|
||
table => 'group_rights',
|
||
|
||
columns => [
|
||
group_id => { type => 'integer', not_null => 1 },
|
||
right => { type => 'text', not_null => 1 },
|
||
granted => { type => 'boolean', not_null => 1 },
|
||
],
|
||
|
||
primary_key_columns => [ 'group_id', 'right' ],
|
||
);
|
||
|
||
1;
|
||
;
|
SL/DB/MetaSetup/AuthUser.pm | ||
---|---|---|
# This file has been auto-generated. Do not modify it; it will be overwritten
|
||
# by rose_auto_create_model.pl automatically.
|
||
package SL::DB::AuthUser;
|
||
|
||
use strict;
|
||
|
||
use base qw(SL::DB::Object);
|
||
|
||
__PACKAGE__->meta->setup(
|
||
table => 'user',
|
||
|
||
columns => [
|
||
id => { type => 'serial', not_null => 1 },
|
||
login => { type => 'text', not_null => 1 },
|
||
password => { type => 'text' },
|
||
],
|
||
|
||
primary_key_columns => [ 'id' ],
|
||
|
||
unique_key => [ 'login' ],
|
||
);
|
||
|
||
1;
|
||
;
|
SL/DB/MetaSetup/AuthUserConfig.pm | ||
---|---|---|
# This file has been auto-generated. Do not modify it; it will be overwritten
|
||
# by rose_auto_create_model.pl automatically.
|
||
package SL::DB::AuthUserConfig;
|
||
|
||
use strict;
|
||
|
||
use base qw(SL::DB::Object);
|
||
|
||
__PACKAGE__->meta->setup(
|
||
table => 'user_config',
|
||
|
||
columns => [
|
||
user_id => { type => 'integer', not_null => 1 },
|
||
cfg_key => { type => 'text', not_null => 1 },
|
||
cfg_value => { type => 'text' },
|
||
],
|
||
|
||
primary_key_columns => [ 'user_id', 'cfg_key' ],
|
||
);
|
||
|
||
1;
|
||
;
|
SL/DB/MetaSetup/AuthUserGroup.pm | ||
---|---|---|
# This file has been auto-generated. Do not modify it; it will be overwritten
|
||
# by rose_auto_create_model.pl automatically.
|
||
package SL::DB::AuthUserGroup;
|
||
|
||
use strict;
|
||
|
||
use base qw(SL::DB::Object);
|
||
|
||
__PACKAGE__->meta->setup(
|
||
table => 'user_group',
|
||
|
||
columns => [
|
||
user_id => { type => 'integer', not_null => 1 },
|
||
group_id => { type => 'integer', not_null => 1 },
|
||
],
|
||
|
||
primary_key_columns => [ 'user_id', 'group_id' ],
|
||
);
|
||
|
||
1;
|
||
;
|
scripts/rose_auto_create_model.pl | ||
---|---|---|
sub process_table {
|
||
my @spec = split(/=/, shift, 2);
|
||
my $table = $spec[0];
|
||
my $schema = '';
|
||
($schema, $table) = split(m/\./, $table) if $table =~ m/\./;
|
||
my $package = ucfirst($spec[1] || $spec[0]);
|
||
$package =~ s/_+(.)/uc($1)/ge;
|
||
my $meta_file = "${meta_path}/${package}.pm";
|
||
my $file = "SL/DB/${package}.pm";
|
||
|
||
$schema = <<CODE if $schema;
|
||
__PACKAGE__->meta->schema('$schema');
|
||
CODE
|
||
|
||
my $definition = eval <<CODE;
|
||
package SL::DB::AUTO::$package;
|
||
use SL::DB::Object;
|
||
use base qw(SL::DB::Object);
|
||
|
||
__PACKAGE__->meta->table('$table');
|
||
$schema
|
||
__PACKAGE__->meta->auto_initialize;
|
||
|
||
__PACKAGE__->meta->perl_class_definition(indent => 2); # , braces => 'bsd'
|
Auch abrufbar als: Unified diff
RDBO-Models für die Klassen im auth-Schema