Page Menu
Home
GRNET
Search
Configure Global Search
Log In
Files
F1299731
users_controller.rb
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Nov 19, 12:35 AM
Size
902 B
Mime Type
text/x-ruby
Expires
Fri, Nov 21, 12:35 AM (1 d, 9 h)
Engine
blob
Format
Raw Data
Handle
294220
Attached To
rWEBDNS WebDNS (edet4)
users_controller.rb
View Options
module
Admin
class
UsersController
<
ApplicationController
before_action
:authenticate_user!
before_action
:admin_only!
# GET /users
def
index
@users
=
User
.
all
end
# GET /users/orphans
def
orphans
@users
=
User
.
orphans
end
# DELETE /users/:id
def
destroy
@user
=
User
.
find
(
params
[
:id
]
)
@user
.
destroy
redirect_to
orphans_admin_users_path
,
notice
:
"
#{
@user
.
email
}
was deleted."
end
def
update
additions
=
0
params
.
each_pair
{
|
k
,
group_id
|
next
if
!
k
.
start_with?
(
'orphan-'
)
_
,
id
=
k
.
split
(
'-'
,
2
)
user
=
User
.
orphans
.
find_by_id
(
id
)
next
if
!
user
group
=
Group
.
find_by_id
(
group_id
)
next
if
!
group
user
.
groups
<<
group
additions
+=
1
}
redirect_to
:back
,
notice
:
"
#{
additions
}
users were assigned to groups"
end
end
end
Event Timeline
Log In to Comment