Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ ViewCustomize = {
"admin": true,
"firstname": "Redmine",
"lastname": "Admin",
"last_login_on": "2019-09-22T14:44:53Z",
"groups": [
{"id": 5, "name": "Group1"}
],
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ ViewCustomize = {
"admin": true,
"firstname": "Redmine",
"lastname": "Admin",
"last_login_on": "2019-09-22T14:44:53Z",
"groups": [
{"id": 5, "name": "Group1"}
],
Expand Down
3 changes: 3 additions & 0 deletions lib/view_customize/view_hook.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'time'

module RedmineViewCustomize
class ViewHook < Redmine::Hook::ViewListener
def view_layouts_base_html_head(context={})
Expand Down Expand Up @@ -82,6 +84,7 @@ def create_view_customize_context(view_hook_context)
"admin" => user.admin?,
"firstname" => user.firstname,
"lastname" => user.lastname,
"last_login_on" => (user.last_login_on.iso8601 unless user.last_login_on.nil?),
"groups" => user.groups.map {|group| { "id" => group.id, "name" => group.name }},
"apiKey" => (user.api_token.value unless user.api_token.nil?),
"customFields" => user.custom_field_values.map {|field| { "id" => field.custom_field.id, "name" => field.custom_field.name, "value" => field.value }}
Expand Down