debian-mirror-gitlab/config/routes/user.rb

75 lines
2.3 KiB
Ruby
Raw Normal View History

2019-09-30 21:07:59 +05:30
Gitlab.ee do
get 'unsubscribes/:email', to: 'unsubscribes#show', as: :unsubscribe
post 'unsubscribes/:email', to: 'unsubscribes#create'
end
2018-10-15 14:42:47 +05:30
# Allows individual providers to be directed to a chosen controller
# Call from inside devise_scope
def override_omniauth(provider, controller, path_prefix = '/users/auth')
match "#{path_prefix}/#{provider}/callback",
to: "#{controller}##{provider}",
as: "#{provider}_omniauth_callback",
via: [:get, :post]
end
# Use custom controller for LDAP omniauth callback
2019-12-26 22:10:19 +05:30
if Gitlab::Auth::LDAP::Config.sign_in_enabled?
2018-10-15 14:42:47 +05:30
devise_scope :user do
Gitlab::Auth::LDAP::Config.available_servers.each do |server|
override_omniauth(server['provider_name'], 'ldap/omniauth_callbacks')
end
end
end
2016-11-03 12:29:30 +05:30
devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks,
registrations: :registrations,
passwords: :passwords,
sessions: :sessions,
confirmations: :confirmations }
devise_scope :user do
get '/users/auth/:provider/omniauth_error' => 'omniauth_callbacks#omniauth_error', as: :omniauth_error
get '/users/almost_there' => 'confirmations#almost_there'
2019-09-30 21:07:59 +05:30
Gitlab.ee do
get '/users/auth/kerberos_spnego/negotiate' => 'omniauth_kerberos_spnego#negotiate'
end
end
scope '-/users', module: :users do
resources :terms, only: [:index] do
post :accept, on: :member
post :decline, on: :member
end
2016-11-03 12:29:30 +05:30
end
2017-09-10 17:25:29 +05:30
scope(constraints: { username: Gitlab::PathRegex.root_namespace_route_regex }) do
2017-08-17 22:00:37 +05:30
scope(path: 'users/:username',
as: :user,
controller: :users) do
get :calendar
get :calendar_activities
get :groups
get :projects
get :contributed, as: :contributed_projects
2019-10-12 21:52:04 +05:30
get :starred, as: :starred_projects
2017-08-17 22:00:37 +05:30
get :snippets
get :exists
2019-12-26 22:10:19 +05:30
get :suggests
2018-12-05 23:21:45 +05:30
get :activity
2018-03-17 18:26:18 +05:30
get '/', to: redirect('%{username}'), as: nil
2017-08-17 22:00:37 +05:30
end
end
2017-09-10 17:25:29 +05:30
2018-05-09 12:01:36 +05:30
constraints(::Constraints::UserUrlConstrainer.new) do
2017-09-10 17:25:29 +05:30
# Get all keys of user
get ':username.keys' => 'profiles/keys#get_keys', constraints: { username: Gitlab::PathRegex.root_namespace_route_regex }
scope(path: ':username',
as: :user,
constraints: { username: Gitlab::PathRegex.root_namespace_route_regex },
controller: :users) do
get '/', action: :show
end
end