Bug #6652
closed[API] Error "Owner uuid must refer to a user with a username" when creating a new repository.
Description
- Admin gear menu → Repositories → "Add a new repository" button -- fail
- User menu → Manage Account → "Add new repository" button -- success
arv repository create --repository '{"name":"myusername/foobar"}'
-- fail
validate
methods run first, including:valid_owner
in source:services/api/app/models/repository.rbbefore_create
methods run later, including:ensure_owner_uuid_is_permitted
in source:services/api/app/models/arvados_model.rb, which is where we set owner_uuid to current_user.uuid if it's not set yet.
If these happened in the reverse order, :valid_owner
would pass.
Updated by Tom Clegg over 9 years ago
- Subject changed from [Workbench] Fiddlesticks error "Owner uuid must refer to a user with a username" error accessing "Add a new repository" button in the settings menu. Works in "manage account" page. to [API] Error "Owner uuid must refer to a user with a username" when creating a new repository.
- Description updated (diff)
Updated by Tom Clegg over 9 years ago
- Category set to API
- Story points set to 0.5
This might be easy to fix by moving self.owner_uuid ||= current_user.uuid
into a before_validation
method.
(Obviously it needs a test case, too.)
Updated by Manoj Malipeddu over 9 years ago
In 4999699d7614f214eb8718b85c5c30e9fb382c23:
Added tests for the system menu and the pages in the dropdown menu.
Updated by Manoj Malipeddu over 9 years ago
In 61d432f332dd9314f8c4cd57c2393e80e8ecef59:
System menu test now skips repositories and test has been moved to application_layout_test.
Updated by Manoj Malipeddu over 9 years ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
Applied in changeset arvados|commit:9b2bf1dddd21c991623e4b2b8b412e1f3fb05d34.
Updated by Brett Smith over 9 years ago
- Status changed from Resolved to New
Re-opening this because it doesn't sound like we made the desired API changes.
Updated by Brett Smith over 9 years ago
- Target version changed from Bug Triage to 2015-09-02 sprint
Updated by Radhika Chippada over 9 years ago
I played with Tom's suggestion "moving self.owner_uuid ||= current_user.uuid into a before_validation method" and this does not solve the problem.
Once this is in place, the creation fails on name_format check. Thus, to solve this:- need to make the API update
- update workbench to show the same popup as in user/repositories page. Alternatively, we can hide the New button admin#repositories page. I think this might actually be the right option, because what good is it to create all these repositories as <admin_user>/repo_name?
- "arv repository create" should work provided name is provided as in Tom's example in the description.
Updated by Brett Smith over 9 years ago
- Target version changed from 2015-09-02 sprint to Arvados Future Sprints
Updated by Brett Smith over 9 years ago
- Target version changed from Arvados Future Sprints to 2015-09-02 sprint
Updated by Brett Smith over 9 years ago
- Target version changed from 2015-09-02 sprint to Arvados Future Sprints
Updated by Tom Clegg over 9 years ago
- Status changed from New to Resolved
This bug was fixed and merged with #6663. Now this succeeds:
$ arv repository create --repository '{"name":"myusername/foobar"}'Workbench still has a non-functional "Add repository" button on the /repositories page (which is linked from the admin menu) but
- it now gives a legitimate error that indicates a Workbench flaw instead of an API flaw: "Name must be the owner's username, then '/', then a letter followed by alphanumerics"
- that button is useless anyway because users can create their own repositories on the user menu -> Repositories page. It should be removed.
Updated by Radhika Chippada over 9 years ago
- Status changed from Resolved to In Progress
- Assigned To set to Manoj Malipeddu
- Target version changed from Arvados Future Sprints to 2015-08-19 sprint
Updated by Radhika Chippada over 9 years ago
Reopening to address the last comment added by Tom in note #12.
So, what needs to be done: When accessed from admin settings menu,
- /repositories page should not offer the "Add a new repository" button
- /authorized_keys page also does not need to offer the "Add a new authorized key" button.
Updated by Manoj Malipeddu over 9 years ago
In 84d14d659b8c31c266a3b08e688171f90fe46cad:
Add a new repository and add a new authorized key buttons no longer appear in the admin pages and tests have been updated.
Updated by Radhika Chippada over 9 years ago
Review comments:
- Please add an else block for "if add_button_text" in the test
if add_button_text assert_selector 'button', text: "Add a new #{add_button_text}" find('button', text: "Add a new #{add_button_text}").click else assert_no_selector 'button', text: "Add a new" end
- Can you please use "assert_text" instead of "page.has_text?" in the last statement of the test
Thanks.
Updated by Manoj Malipeddu over 9 years ago
In 3bfb9c5cbf5dd56b84fd17f9e1dcdd6a219fe5fe:
Added else statement and changed assertion to use assert_text in "test system menu #{page_name} link".
Updated by Manoj Malipeddu over 9 years ago
- Status changed from In Progress to Resolved
- % Done changed from 0 to 100
Applied in changeset arvados|commit:c1ceb0f74d5547c56cf6cdde56044adba171efaf.