Project

General

Profile

Actions

Bug #15108

closed

Cloned role has no builtin value

Added by Paul Smyth almost 8 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Users, Roles and Permissions
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Creating a new role from the Administer table by cloning an existing role results in no value being entered into the 'builtin' field. This makes the role non selectable in the user and groups menus and not deletable. Work around is to update the roles table directly eg: "update roles set builtin = 0 where id = xx;".

Note: This is 1.11.2 which is not selectable below so please accept my apologies if this has been fixed in 1.11.3


Related issues 2 (1 open1 closed)

Related to Foreman - Refactor #15621: Change role builtin attribute to booleanNew07/08/2016Actions
Has duplicate Foreman - Bug #15520: Delete cloned role via APIDuplicate06/24/2016Actions
Actions #1

Updated by Paul Smyth almost 8 years ago

Should say "Administer menu"

Actions #2

Updated by Dominic Cleal almost 8 years ago

  • Category set to Users, Roles and Permissions
  • translation missing: en.field_release deleted (159)

I'm not able to reproduce this, albeit on nightly/1.12 (which shouldn't really be any different in this regard). The entire role including the old role's builtin field should be copied.

Edit: actually, builtin is even explicitly set to false during creation.

Actions #3

Updated by Paul Smyth almost 8 years ago

This is the output of "select * from roles" after cloning the role "viewer" into "New test viewer":
id | name | builtin | permissions
----+--------------------------+---------+-------------
1 | Manager | 0 |
2 | Edit partition tables | 0 |
3 | View hosts | 0 |
4 | Edit hosts | 0 |
5 | Viewer | 0 |
6 | Site manager | 0 |
7 | Default user | 1 |
8 | Anonymous | 2 |
9 | Provisioning setup | 0 |
10 | Discovery Reader | 0 |
11 | Discovery Manager | 0 |
12 | Tasks Manager | 0 |
13 | Tasks Reader | 0 |
14 | Remote Execution User | 0 |
15 | Remote Execution Manager | 0 |
16 | Developer | 0 |
20 | New test viewer | |

As you can see there is no value in the 'builtin' column. This is simply cloning without altering any filters

Actions #4

Updated by Paul Smyth almost 8 years ago

Looking at the table schema, the 'builtin' field is an integer, not a boolean. Is it possible that false is not 'FALSE' in this instance therefore not applying the value zero to the field?

Column    |          Type          |                     Modifiers                      | Storage  | Stats target | Description 
-------------+------------------------+----------------------------------------------------+----------+--------------+-------------
id | integer | not null default nextval('roles_id_seq'::regclass) | plain | |
name | character varying(255) | | extended | |
builtin | integer | | plain | |
permissions | text | | extended | |
Indexes:
"roles_pkey" PRIMARY KEY, btree (id)
Referenced by:
TABLE "filters" CONSTRAINT "filters_roles_id_fk" FOREIGN KEY (role_id) REFERENCES roles(id)
TABLE "user_roles" CONSTRAINT "user_roles_role_id_fk" FOREIGN KEY (role_id) REFERENCES roles(id)
Has OIDs: no
Actions #5

Updated by Simon Mügge almost 8 years ago

Can confirm this behaviour too, using 1.11.2

Actions #6

Updated by Dominic Cleal almost 8 years ago

  • Status changed from New to Resolved

Thanks, I see it as well now I'm testing on 1.11.2 and it does seem to have disappeared in 1.12.0-RC1, perhaps because we updated Rails or another component. Sorry I missed that earlier.

Since I think it's resolved in 1.12 without a Foreman code change, I'll close this for now, but if somebody wants/knows how to write a 1.11-specific fix then we can re-open it for a patch release.

(A schema change defaulting builtin to 0 would be a possible fix and tidyup, but wouldn't be suitable for a patch release.)

Actions #7

Updated by Dominic Cleal over 7 years ago

  • Has duplicate Bug #15520: Delete cloned role via API added
Actions #8

Updated by Dominic Cleal over 7 years ago

  • Related to Refactor #15621: Change role builtin attribute to boolean added
Actions #9

Updated by Marek Hulán over 7 years ago

  • Status changed from Resolved to Assigned
  • Assignee set to Marek Hulán
  • translation missing: en.field_release set to 175

This is still reproducible in 1.12. The fix was introduced by this migration I'll open a PR fixing it in 1.12 without schema change. In 1.13+ the fix sets builtin value to 0 by default.

Actions #10

Updated by The Foreman Bot over 7 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/3706 added
Actions #11

Updated by Dominic Cleal over 7 years ago

Marek Hulán wrote:

This is still reproducible in 1.12. The fix was introduced by this migration

I think both my comment above (#6) and the observations on
https://github.com/theforeman/foreman/pull/3630#issuecomment-231667333 were made prior to this change in develop. It probably did help (as will #15621's refactoring), but the issue did seem to have disappeared in 1.12.0. Probably a conversation to continue with the PR reviewer.

Actions #12

Updated by Marek Hulán over 7 years ago

I reproduced that issue with 1.12-stable version. While cloning role on 1.12 works fine since false is set, if there are roles from previous version with nil builtin value, it's still broken.

Actions #13

Updated by Marek Hulán over 7 years ago

  • Target version set to 1.6.3
Actions #14

Updated by Dominic Cleal over 7 years ago

  • Status changed from Ready For Testing to Closed

Fixed in 919cde52ef017819767dabd0424a6c6bb6c9e788.

Actions #15

Updated by Shimon Shtein almost 7 years ago

  • Bugzilla link set to 1457658
Actions

Also available in: Atom PDF