MT#56068 fix /api/resellerbrandings reseller_id field

* reseller_id is now only mandatory for the 'admin' role

Change-Id: Idd090332ed2877b2a2c06c9cce741757cc718737
mr11.2
Kirill Solomko 3 years ago
parent e2afe2ea06
commit 34eeac7fc2

@ -3,19 +3,10 @@ package NGCP::Panel::Form::Reseller::BrandingAPI;
use HTML::FormHandler::Moose;
extends 'NGCP::Panel::Form::Reseller::Branding';
has_field 'reseller_id' => (
type => 'PosInteger',
required => 1,
element_attr => {
rel => ['tooltip'],
title => ['The reseller who owns the Branding.'],
},
);
has_block 'fields' => (
tag => 'div',
class => [qw/modal-body/],
render_list => [qw/reseller_id logo css csc_color_primary csc_color_secondary/],
render_list => [qw/logo css csc_color_primary csc_color_secondary/],
);
sub update_fields {

@ -0,0 +1,30 @@
package NGCP::Panel::Form::Reseller::BrandingAPIAdmin;
use HTML::FormHandler::Moose;
extends 'NGCP::Panel::Form::Reseller::BrandingAPI';
has_field 'reseller_id' => (
type => 'PosInteger',
required => 1,
element_attr => {
rel => ['tooltip'],
title => ['The reseller who owns the Branding.'],
},
);
has_block 'fields' => (
tag => 'div',
class => [qw/modal-body/],
render_list => [qw/reseller_id logo css csc_color_primary csc_color_secondary/],
);
sub update_fields {
my ($self) = @_;
my $c = $self->ctx;
return unless($c);
$self->field('logo')->inactive(1);
}
1;
# vim: set tabstop=4 expandtab:

@ -41,7 +41,12 @@ sub config_allowed_roles {
sub get_form {
my ($self, $c) = @_;
#use_fields_for_input_without_param
return (NGCP::Panel::Form::get("NGCP::Panel::Form::Reseller::BrandingAPI", $c));
return NGCP::Panel::Form::get(
$c->user->roles eq "admin"
? "NGCP::Panel::Form::Reseller::BrandingAPIAdmin"
: "NGCP::Panel::Form::Reseller::BrandingAPI",
$c
);
}
sub _item_rs {

Loading…
Cancel
Save