Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
577448ab
Commit
577448ab
authored
Dec 11, 2015
by
Drew Blessing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow admin to create new user identities
parent
2b4a3bc5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
2 deletions
+22
-2
app/controllers/admin/identities_controller.rb
app/controllers/admin/identities_controller.rb
+16
-1
app/views/admin/identities/index.html.haml
app/views/admin/identities/index.html.haml
+1
-0
app/views/admin/identities/new.html.haml
app/views/admin/identities/new.html.haml
+4
-0
config/routes.rb
config/routes.rb
+1
-1
No files found.
app/controllers/admin/identities_controller.rb
View file @
577448ab
class
Admin::IdentitiesController
<
Admin
::
ApplicationController
class
Admin::IdentitiesController
<
Admin
::
ApplicationController
before_action
:user
before_action
:user
before_action
:identity
,
except: :index
before_action
:identity
,
except:
[
:index
,
:new
,
:create
]
def
new
@identity
=
Identity
.
new
end
def
create
@identity
=
Identity
.
new
(
identity_params
)
@identity
.
user_id
=
user
.
id
if
@identity
.
save
redirect_to
admin_user_identities_path
(
@user
),
notice:
'User identity was successfully created.'
else
render
:new
end
end
def
index
def
index
@identities
=
@user
.
identities
@identities
=
@user
.
identities
...
...
app/views/admin/identities/index.html.haml
View file @
577448ab
-
page_title
"Identities"
,
@user
.
name
,
"Users"
-
page_title
"Identities"
,
@user
.
name
,
"Users"
=
render
'admin/users/head'
=
render
'admin/users/head'
=
link_to
'New Identity'
,
new_admin_user_identity_path
,
class:
'pull-right btn btn-new'
-
if
@identities
.
present?
-
if
@identities
.
present?
.table-holder
.table-holder
%table
.table
%table
.table
...
...
app/views/admin/identities/new.html.haml
0 → 100644
View file @
577448ab
-
page_title
"New Identity"
%h3
.page-title
New identity
%hr
=
render
'form'
config/routes.rb
View file @
577448ab
...
@@ -188,7 +188,7 @@ Rails.application.routes.draw do
...
@@ -188,7 +188,7 @@ Rails.application.routes.draw do
namespace
:admin
do
namespace
:admin
do
resources
:users
,
constraints:
{
id:
/[a-zA-Z.\/0-9_\-]+/
}
do
resources
:users
,
constraints:
{
id:
/[a-zA-Z.\/0-9_\-]+/
}
do
resources
:keys
,
only:
[
:show
,
:destroy
]
resources
:keys
,
only:
[
:show
,
:destroy
]
resources
:identities
,
only:
[
:index
,
:edit
,
:update
,
:destroy
]
resources
:identities
,
except:
[
:show
]
delete
'stop_impersonation'
=>
'impersonation#destroy'
,
on: :collection
delete
'stop_impersonation'
=>
'impersonation#destroy'
,
on: :collection
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment