Skip to content

Commit

Permalink
Add description to server types
Browse files Browse the repository at this point in the history
  • Loading branch information
abeverley committed Jan 3, 2025
1 parent 29eec39 commit 7a5e173
Show file tree
Hide file tree
Showing 31 changed files with 5,126 additions and 67 deletions.
11 changes: 10 additions & 1 deletion lib/Brass/Config/Server/Type.pm
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,22 @@ has name => (
builder => sub { $_[0]->_rset && $_[0]->_rset->name; },
);

has description => (
is => 'rw',
lazy => 1,
builder => sub { $_[0]->_rset && $_[0]->_rset->description; },
);

sub _build__rset
{ my $self = shift;
$self->schema->resultset('Servertype')->find($self->id);
}

sub as_string
{ my $self = shift;
$self->name;
my $string = $self->name;
$string .= " (".$self->description.")" if $self->description;
$string;
}

sub as_integer
Expand All @@ -63,6 +71,7 @@ sub inflate_result {
$_[0]->new(
id => $data->{id},
name => $data->{name},
description => $data->{description},
schema => $_[1]->schema,
);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Brass/Schema.pm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ __PACKAGE__->load_namespaces;
# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-10-01 11:03:29
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:GqW9kl7MrcAx0vieFGh+cw

our $VERSION = 45;
our $VERSION = 46;

# You can replace this text with custom code or comments, and it will be preserved on regeneration
1;
66 changes: 2 additions & 64 deletions lib/Brass/Schema/Result/Servertype.pm
Original file line number Diff line number Diff line change
@@ -1,95 +1,33 @@
use utf8;
package Brass::Schema::Result::Servertype;

=head1 NAME
Brass::Schema::Result::Servertype
=cut

use strict;
use warnings;

use base 'DBIx::Class::Core';

=head1 COMPONENTS LOADED
=over 4
=item * L<DBIx::Class::InflateColumn::DateTime>
=back
=cut

__PACKAGE__->load_components("InflateColumn::DateTime");

=head1 TABLE: C<type>
=cut

__PACKAGE__->table("servertype");

=head1 ACCESSORS
=head2 id
data_type: 'integer'
is_auto_increment: 1
is_nullable: 0
=head2 name
data_type: 'varchar'
is_nullable: 1
size: 45
=cut

__PACKAGE__->add_columns(
"id",
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
"name",
{ data_type => "varchar", is_nullable => 1, size => 45 },
"description",
{ data_type => "text", is_nullable => 1 },
);

=head1 PRIMARY KEY
=over 4
=item * L</id>
=back
=cut

__PACKAGE__->set_primary_key("id");

=head1 RELATIONS
=head2 server_servertypes
Servertype: has_many
Related object: L<Brass::Schema::Result::ServerServertype>
=cut

__PACKAGE__->has_many(
"server_servertypes",
"Brass::Schema::Result::ServerServertype",
{ "foreign.servertype_id" => "self.id" },
{ cascade_copy => 0, cascade_delete => 0 },
);

=head2 user_servertypes
Servertype: has_many
Related object: L<Brass::Schema::Result::UserServertype>
=cut

__PACKAGE__->has_many(
"user_servertypes",
"Brass::Schema::Result::UserServertype",
Expand Down
185 changes: 185 additions & 0 deletions share/fixtures/46/conf/all_tables.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
{
"belongs_to" : {
"fetch" : 0
},
"might_have" : {
"fetch" : 0
},
"sets" : [
{
"class" : "UserTopic",
"quantity" : "all"
},
{
"class" : "EventPerson",
"quantity" : "all"
},
{
"class" : "UserDocreadtype",
"quantity" : "all"
},
{
"class" : "IssueTag",
"quantity" : "all"
},
{
"class" : "Docsend",
"quantity" : "all"
},
{
"quantity" : "all",
"class" : "UserDocread"
},
{
"class" : "Event",
"quantity" : "all"
},
{
"class" : "Servertype",
"quantity" : "all"
},
{
"class" : "Cert",
"quantity" : "all"
},
{
"class" : "Docreadtype",
"quantity" : "all"
},
{
"quantity" : "all",
"class" : "Issuetype"
},
{
"class" : "DocDocreadtype",
"quantity" : "all"
},
{
"class" : "IssuePriority",
"quantity" : "all"
},
{
"class" : "App",
"quantity" : "all"
},
{
"class" : "ServerPw",
"quantity" : "all"
},
{
"class" : "PwServertype",
"quantity" : "all"
},
{
"quantity" : "all",
"class" : "Domain"
},
{
"class" : "CertLocationUse",
"quantity" : "all"
},
{
"class" : "Status",
"quantity" : "all"
},
{
"class" : "Priority",
"quantity" : "all"
},
{
"class" : "UserPermission",
"quantity" : "all"
},
{
"class" : "Uad",
"quantity" : "all"
},
{
"quantity" : "all",
"class" : "Comment"
},
{
"class" : "CertUse",
"quantity" : "all"
},
{
"quantity" : "all",
"class" : "ServerCert"
},
{
"class" : "Customer",
"quantity" : "all"
},
{
"class" : "Calendar",
"quantity" : "all"
},
{
"class" : "ServerServertype",
"quantity" : "all"
},
{
"class" : "Project",
"quantity" : "all"
},
{
"class" : "Tag",
"quantity" : "all"
},
{
"class" : "CertLocation",
"quantity" : "all"
},
{
"quantity" : "all",
"class" : "Site"
},
{
"quantity" : "all",
"class" : "Pw"
},
{
"class" : "Server",
"quantity" : "all"
},
{
"quantity" : "all",
"class" : "Config"
},
{
"quantity" : "all",
"class" : "Permission"
},
{
"class" : "User",
"quantity" : "all"
},
{
"quantity" : "all",
"class" : "UserProject"
},
{
"class" : "File",
"quantity" : "all"
},
{
"class" : "Issue",
"quantity" : "all"
},
{
"quantity" : "all",
"class" : "Eventtype"
},
{
"class" : "UserServertype",
"quantity" : "all"
},
{
"quantity" : "all",
"class" : "IssueStatus"
}
],
"has_many" : {
"fetch" : 0
}
}
17 changes: 17 additions & 0 deletions share/fixtures/46/conf/permission.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"has_many" : {
"fetch" : 0
},
"sets" : [
{
"quantity" : "all",
"class" : "Permission"
}
],
"might_have" : {
"fetch" : 0
},
"belongs_to" : {
"fetch" : 0
}
}
17 changes: 17 additions & 0 deletions share/fixtures/46/permission/_config_set
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
$VAR1 = {
'belongs_to' => {
'fetch' => 0
},
'has_many' => {
'fetch' => 0
},
'might_have' => {
'fetch' => 0
},
'sets' => [
{
'quantity' => 'all',
'class' => 'Permission'
}
]
};
1 change: 1 addition & 0 deletions share/fixtures/46/permission/_dumper_version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.001039
6 changes: 6 additions & 0 deletions share/fixtures/46/permission/permission/1.fix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
$HASH1 = {
description
=> 'User can view documents',
id => 1,
name => 'doc'
};
6 changes: 6 additions & 0 deletions share/fixtures/46/permission/permission/10.fix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
$HASH1 = {
description
=> 'User can view configuration information',
id => 10,
name => 'config'
};
6 changes: 6 additions & 0 deletions share/fixtures/46/permission/permission/11.fix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
$HASH1 = {
description
=> 'User can write configuration information',
id => 11,
name => 'config_write'
};
6 changes: 6 additions & 0 deletions share/fixtures/46/permission/permission/12.fix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
$HASH1 = {
description
=> 'User can create and update any issue for certain projects',
id => 12,
name => 'issue_write_project'
};
6 changes: 6 additions & 0 deletions share/fixtures/46/permission/permission/13.fix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
$HASH1 = {
description
=> 'User can read the calendar',
id => 13,
name => 'calendar_read'
};
Loading

0 comments on commit 7a5e173

Please sign in to comment.