ruby plugin to get username
Added by Rahul P over 13 years ago
hi everyone,
i am trying to write a plugin which fetches the username from the field - "Logged in as <username>", however, i do not know how to access the variable value. can someone please guide me?
any help is much appreciated.
Thanks,
Rahul
Replies (1)
RE: ruby plugin to get username
-
Added by Rahul P over 13 years ago
Here is a sample of what I am trying to do
class TabController < ApplicationController
unloadable
layout 'base'
before_filter :find_project, :authorize, :only => [:show]
def show
@tab_text = Setting.plugin_redmine_tab['system_tab_text_project']
@tab_text['{username}'] = 'GET CURRENT USERNAME'
@tab_text['{pid}'] = 'GET CURRENT PROJECT ID i.e myproject'
end
def system_show
@tab_text = Setting.plugin_redmine_tab['system_tab_text']
render :action => 'show'
end
private
def find_project
- Herve Harster variable must be set before calling the authorize filter
Herve Harster = Project.find(params[:id])
rescue ActiveRecord::RecordNotFound
render_404
end
end