Skip to content

Commit

Permalink
F #5204 Changed append template for restricted attributes (#453)
Browse files Browse the repository at this point in the history
  • Loading branch information
juanmont authored and rsmontero committed Sep 6, 2017
1 parent a11524a commit 329652e
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/pool/PoolObjectSQL.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ int PoolObjectSQL::append_template(
{
Template * old_tmpl = 0;
Template * new_tmpl = get_new_template();
string rname;

if ( new_tmpl == 0 )
{
Expand All @@ -255,19 +256,26 @@ int PoolObjectSQL::append_template(
return -1;
}

if (keep_restricted)
{
new_tmpl->remove_restricted();
}

if ( obj_template != 0 )
{
if (keep_restricted && new_tmpl->check_restricted(rname, obj_template))
{
error ="User Template includes a restricted attribute " + rname;
delete new_tmpl;
return -1;
}
obj_template->merge(new_tmpl);

delete new_tmpl;
}
else
{
if (keep_restricted && new_tmpl->check_restricted(rname))
{
error ="User Template includes a restricted attribute " + rname;
delete new_tmpl;
return -1;
}
obj_template = new_tmpl;
}

Expand Down

0 comments on commit 329652e

Please sign in to comment.