"GitLab export" under new project missing for non-admins
Summary
Even though it's enabled in the site settings, the "GitLab export" button appears to be missing under "New Project" for non site admins, and attempting to browse manually to the URL to import a exported project shows a 404. This behavior seems to be expected if the gitlab_project import source is disabled, but is is not disabled (shown in the rails console):
Loading production environment (Rails 4.2.7.1)
irb(main):001:0> current_application_settings.import_sources.include?('gitlab_project')
=> true
Steps to reproduce
- As an admin, confirm that the GitLab export import source is enabled in the site settings (https://gitlab.inetu.net/admin/application_settings)
- Impersonate a non-admin on the site.
- Click New Project, or browse to https://gitlab.server/projects/new
Expected behavior
The "GitLab export" button should be shown.
Actual
The "GitLab export" button is missing.
Relevant logs and/or screenshots
Administrator creating an imported project:
Started GET "/projects/new" for 172.25.1.29 at 2016-10-10 14:24:40 -0400
Processing by ProjectsController#new as HTML
Completed 200 OK in 97ms (Views: 62.6ms | ActiveRecord: 10.7ms)
Started GET "/import/gitlab_project/new?namespace_id=9&path=123" for 172.25.1.29 at 2016-10-10 14:24:46 -0400
Processing by Import::GitlabProjectsController#new as HTML
Parameters: {"namespace_id"=>"2", "path"=>"test"}
Completed 200 OK in 50ms (Views: 24.0ms | ActiveRecord: 5.8ms)
Impersonating a user and attempting an import:
Started GET "/admin" for 172.25.1.29 at 2016-10-10 14:30:36 -0400
Processing by Admin::DashboardController#index as HTML
Completed 200 OK in 126ms (Views: 80.4ms | ActiveRecord: 23.7ms)
Started GET "/admin/users/REDACTED" for 172.25.1.29 at 2016-10-10 14:30:46 -0400
Processing by Admin::UsersController#show as HTML
Parameters: {"id"=>"REDACTED"}
Completed 200 OK in 87ms (Views: 51.8ms | ActiveRecord: 11.6ms)
Started POST "/admin/users/REDACTED/impersonate" for 172.25.1.29 at 2016-10-10 14:30:51 -0400
Processing by Admin::UsersController#impersonate as HTML
Parameters: {"authenticity_token"=>"REDACTED", "id"=>"REDACTED"}
Redirected to https://gitlab.REDACTED/
Completed 302 Found in 40ms (ActiveRecord: 8.3ms)
Started GET "/" for 172.25.1.29 at 2016-10-10 14:30:51 -0400
Processing by RootController#index as HTML
Read fragment views/namespaces/16-20161010173332798960000/projects/6-20161010174353724274000/root/index/application_settings/5-20161010181754644424000/v2.3/db0d9b93a29c1ffd1db53e9b3d95f713 (0.7ms)
Completed 200 OK in 124ms (Views: 64.5ms | ActiveRecord: 17.3ms)
Started GET "/projects/new" for 172.25.1.29 at 2016-10-10 14:30:53 -0400
Processing by ProjectsController#new as HTML
Completed 200 OK in 87ms (Views: 52.2ms | ActiveRecord: 11.8ms)
Started GET "/import/gitlab_project/new?namespace_id=9&path=123" for 172.25.1.29 at 2016-10-10 14:31:03 -0400
Processing by Import::GitlabProjectsController#new as HTML
Parameters: {"namespace_id"=>"9", "path"=>"123"}
Filter chain halted as :authenticate_admin! rendered or redirected
Completed 404 Not Found in 24ms (Views: 0.7ms | ActiveRecord: 4.0ms)
The impersonated user has access to namespace_id 9.
Output of checks
Results of GitLab application Check
Checking GitLab Shell ...
GitLab Shell version >= 3.6.1 ? ... OK (3.6.1)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ...
2/1 ... ok
11/5 ... ok
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK
Send ping to redis server: OK
gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes
Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking Reply by email ...
IMAP server credentials are correct? ... yes
Init.d configured correctly? ... skipped (omnibus-gitlab has no init script)
MailRoom running? ... can't check because of previous errors
Checking Reply by email ... Finished
Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
Git configured with autocrlf=input? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory setup correctly? ... yes
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
projects have namespace: ...
2/1 ... yes
11/5 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.1.0 ? ... yes (2.3.1)
Your git bin path is "/opt/gitlab/embedded/bin/git"
Git version >= 2.7.3 ? ... yes (2.7.4)
Active users: 11
Checking GitLab ... Finished
Results of GitLab environment info
System information
System: CentOS 7.2.1511
Current User: git
Using RVM: no
Ruby Version: 2.3.1p112
Gem Version: 2.6.6
Bundler Version:1.13.2
Rake Version: 10.5.0
Sidekiq Version:4.1.4
GitLab information
Version: 8.12.4
Revision: ba8aeb7
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: postgresql
URL: https://gitlab.REDACTED
HTTP Clone URL: https://gitlab.REDACTED/some-group/some-project.git
SSH Clone URL: git@gitlab.REDACTED:some-group/some-project.git
Using LDAP: no
Using Omniauth: yes
Omniauth Providers: saml
GitLab Shell
Version: 3.6.1
Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories
Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks/
Git: /opt/gitlab/embedded/bin/git


