Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stable 2.8 #2

Open
wants to merge 14 commits into
base: stable-2.7
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source "https://rubygems.org"

group :test do
gem "libxml-ruby", ">= 2.3.2"
end
67 changes: 65 additions & 2 deletions README.rdoc
Original file line number Diff line number Diff line change
@@ -1,3 +1,66 @@
= mylyn_connector
= redmine_mylyn_connector

Description goes here
API Connector for mylyn [redmine-myln-connector] as developed originally by Sven Krzyzak (http://sourceforge.net/projects/redmin-mylyncon)

Note for Redmine 1.* users: consider if http://sourceforge.net/projects/redmin-mylyncon will suit your needs

This plugin provides additional API functionality within Redmine, and is part-modification of the original project providing a working base for redmine 2.0 upwards.

Redmine is a flexible project management web application, released under the terms of the GNU General Public License v2 (GPL) at http://www.redmine.org

== Dependency

As of 1.8.0 of this plugin, Redmine 2.0.0 or greater is required, Rails 2.3.2 (onwards), with test-cases requiring libxml-ruby Gem.

== Installation

Before installing ensure that the Redmine instance is stopped.

1. <tt>cd [redmine-install-dir]/plugins</tt>
3. <tt>git clone git://github.com/danmunn/redmine_mylyn_connector.git</tt>
4. <tt>cd ..</tt>
5. <tt>bundle install --without development test</tt>

After these steps re-start your instance of Redmine and the plugin will be installed.

== Uninstallation

Before uninstalling please ensure that the Redmine instance is stopped.

1. <tt>cd [redmine-install-dir]</tt>
2. <tt>rm -Rf plugins/redmine_mylyn_connector</tt>

After these steps re-start your instance of Redmine.

== Testing

The plugin comes with a test suite that can be run once the plugin is installed into a Redmine instance.

The process to run the functional tests is as follows
1. <tt>cd [redmine-install-dir]/plugins/redmine_mylyn_connector</tt>
2. <tt>bundle install --without development</tt>
3. <tt>rake</tt>

There are known bugs on the integration test at present which will be rectified at a later point.

== Reporting an Issue

If you have a problem, please report it on the github project - http://github.com/danmunn/redmine_mylyn_connector.

However if you do have an issue with Redmine, or that is not related to the plugin they either need to go via the support portal at Redmine (http://www.redmine.org/projects/redmine/issues/new) or the support portal relevent to the plugin.

Be sure to include Rails version, plugin version, and when possible a stack trace of the error being seen.


== Contributing

If you've added something, why not share it. Fork the repository (http://github.com/danmunn/redmine_mylyn_connector), make the changes and send a pull request to the maintainers.

Changes with tests, and full documentation are preferred.


= Credits

This plugin was created by Sven Krzyzak <http://sourceforge.net/users/sven-k>

This plugin is currently maintained by Daniel Munn <https://github.com/danmunn>
32 changes: 32 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env rake
require 'rake'
begin
require 'rdoc/task'
rescue LoadError
require 'rdoc/rdoc'
require 'rdoc/rdoctask'
RDoc::Task = Rake::RDocTask
end
require 'rake/testtask'

#Bundler::GemHelper.install_tasks

desc 'Default: run unit tests.'
task :default => :test

#desc 'Run all tests for redmine_mylyn_connector.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end

#desc 'Build documentation for redmine_mylyn_connector.'
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'Redmine Mylyn Connector'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('README.rdoc')
rdoc.rdoc_files.include('lib/**/*.rb')
end
13 changes: 4 additions & 9 deletions app/controllers/mylyn_connector/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
class MylynConnector::ApplicationController < ApplicationController
unloadable

def self.accept_api_auth(*actions)

begin
super *actions #Redmine>=1.2
rescue
accept_key_auth *actions #Redmine<1.2
end
end

include MylynConnector::Rescue

before_filter :require_login #Require a successful login to render page

end
5 changes: 1 addition & 4 deletions app/controllers/mylyn_connector/custom_fields_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@

class MylynConnector::CustomFieldsController < MylynConnector::ApplicationController
unloadable
include MylynConnector::Rescue::ClassMethods

accept_api_auth :all

skip_before_filter :verify_authenticity_token

helper MylynConnector::MylynHelper

def all
@custom_fields = CustomField.all

respond_to do |format|
format.xml {render :layout => false}
format.xml {render :layout => nil}
end
end

Expand Down
8 changes: 2 additions & 6 deletions app/controllers/mylyn_connector/information_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,24 @@

class MylynConnector::InformationController < MylynConnector::ApplicationController
unloadable
include MylynConnector::Rescue::ClassMethods
include MylynConnector::Version::ClassMethods

accept_api_auth :version, :token, :authtest

skip_before_filter :verify_authenticity_token

helper MylynConnector::MylynHelper

def version
@data = MylynConnector::Version.to_a

respond_to do |format|
format.xml {render :layout => false}
format.xml {render :layout => nil}
end
end

def token
#Workaround: we need a session, some operations does'nt support key-auth
self.logged_user = User.current unless User.current.anonymous?

render :text => form_authenticity_token
render :xml => form_authenticity_token
end

def authtest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@

class MylynConnector::IssueCategoriesController < MylynConnector::ApplicationController
unloadable
include MylynConnector::Rescue::ClassMethods

accept_api_auth :all

skip_before_filter :verify_authenticity_token

helper MylynConnector::MylynHelper

def all
@issue_categories = IssueCategory.find(:all)

respond_to do |format|
format.xml {render :layout => false}
format.xml {render :layout => nil}
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,16 @@

class MylynConnector::IssuePrioritiesController < MylynConnector::ApplicationController
unloadable
include MylynConnector::Rescue::ClassMethods
include MylynConnector::Version::ClassMethods

accept_api_auth :all

skip_before_filter :verify_authenticity_token

helper MylynConnector::MylynHelper

def all
@priorities = IssuePriority.shared.active;

respond_to do |format|
format.xml {render :layout => false}
format.xml {render :layout => nil}
end
end

Expand Down
5 changes: 1 addition & 4 deletions app/controllers/mylyn_connector/issue_status_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@

class MylynConnector::IssueStatusController < MylynConnector::ApplicationController
unloadable
include MylynConnector::Rescue::ClassMethods

accept_api_auth :all

skip_before_filter :verify_authenticity_token

helper MylynConnector::MylynHelper

def all
@issue_status = IssueStatus.find(:all)

respond_to do |format|
format.xml {render :layout => false}
format.xml {render :layout => nil}
end
end
end
13 changes: 6 additions & 7 deletions app/controllers/mylyn_connector/issues_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

class MylynConnector::IssuesController < MylynConnector::ApplicationController
unloadable
include MylynConnector::Rescue::ClassMethods

accept_api_auth :show, :index, :list, :updated_since

Expand All @@ -22,7 +21,7 @@ class MylynConnector::IssuesController < MylynConnector::ApplicationController

def show
respond_to do |format|
format.xml {render :layout => false}
format.xml {render :layout => nil}
end
end

Expand All @@ -34,7 +33,7 @@ def index
@issues = @query.issues(:include=>[:assigned_to, :tracker, :priority, :category, :fixed_version])

respond_to do |format|
format.xml {render :layout => false}
format.xml {render :layout => nil}
end

else
Expand All @@ -60,10 +59,10 @@ def updated_since
@issues = Issue.find(
:all,
:joins => ["join #{Project.table_name} on project_id=#{Project.table_name}.id"],
:conditions => ["#{Issue.table_name}.id in (?) and #{Issue.table_name}.updated_on >= ? and " << Project.visible_by, issues, cond]
:conditions => ["#{Issue.table_name}.id in (?) and #{Issue.table_name}.updated_on >= ? and " << Project.visible_condition(User.current), issues, cond]
)
respond_to do |format|
format.xml {render :layout => false}
format.xml {render :layout => nil}
end
end

Expand All @@ -76,10 +75,10 @@ def list
@issues = Issue.find(
:all,
:joins => ["join #{Project.table_name} on project_id=#{Project.table_name}.id"],
:conditions => ["#{Issue.table_name}.id in (?) and " << Project.visible_by, issues]
:conditions => ["#{Issue.table_name}.id in (?) and " << Project.visible_condition(User.current), issues]
)
respond_to do |format|
format.xml {render :layout => false}
format.xml {render :layout => nil}
end
end

Expand Down
7 changes: 2 additions & 5 deletions app/controllers/mylyn_connector/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,18 @@

class MylynConnector::ProjectsController < MylynConnector::ApplicationController
unloadable
include MylynConnector::Rescue::ClassMethods

accept_api_auth :all

skip_before_filter :verify_authenticity_token

helper MylynConnector::MylynHelper

def all
@projects = Project.find(:all,
:joins => :enabled_modules,
:conditions => [ "enabled_modules.name = 'issue_tracking' AND #{Project.visible_by}"])
:conditions => [ "enabled_modules.name = 'issue_tracking' AND #{Project.visible_condition(User.current)}"])

respond_to do |format|
format.xml {render :layout => false}
format.xml {render :layout => nil}
end
end

Expand Down
7 changes: 2 additions & 5 deletions app/controllers/mylyn_connector/queries_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,22 @@

class MylynConnector::QueriesController < MylynConnector::ApplicationController
unloadable
include MylynConnector::Rescue::ClassMethods

accept_api_auth :all

skip_before_filter :verify_authenticity_token

helper MylynConnector::MylynHelper

def all

@queries = Query.find(
:all,
:joins => ["left join #{Project.table_name} on project_id=#{Project.table_name}.id"],
:conditions => ["(#{Query.table_name}.is_public = ? OR #{Query.table_name}.user_id = ?) AND (project_id IS NULL OR " << Project.visible_by << ")", true, User.current.id],
:conditions => ["(#{Query.table_name}.visibility = ? OR #{Query.table_name}.user_id = ?) AND (project_id IS NULL OR " << Project.visible_condition(User.current) << ")", Query::VISIBILITY_PUBLIC, User.current.id],
:order => "#{Query.table_name}.name ASC"
)

respond_to do |format|
format.xml {render :layout => false}
format.xml {render :layout => nil}
end
end
end
5 changes: 1 addition & 4 deletions app/controllers/mylyn_connector/settings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@

class MylynConnector::SettingsController < MylynConnector::ApplicationController
unloadable
include MylynConnector::Rescue::ClassMethods

accept_api_auth :all

skip_before_filter :verify_authenticity_token

helper MylynConnector::MylynHelper

def all
@settings = Setting

respond_to do |format|
format.xml {render :layout => false}
format.xml {render :layout => nil}
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,16 @@

class MylynConnector::TimeEntryActivitiesController < MylynConnector::ApplicationController
unloadable
include MylynConnector::Rescue::ClassMethods
include MylynConnector::Version::ClassMethods

accept_api_auth :all

skip_before_filter :verify_authenticity_token

helper MylynConnector::MylynHelper

def all
@activities = TimeEntryActivity.shared.active

respond_to do |format|
format.xml {render :layout => false}
format.xml {render :layout => nil}
end
end

Expand Down
Loading