Skip to content

Instantly share code, notes, and snippets.

@edavis10
Created March 3, 2010 23:35
Show Gist options
  • Save edavis10/321193 to your computer and use it in GitHub Desktop.
Save edavis10/321193 to your computer and use it in GitHub Desktop.
module RedmineRestricutedStatus
module Patches
module IssuePatch
def self.included(base) # :nodoc:
base.extend(ClassMethods)
base.send(:include, InstanceMethods)
base.class_eval do
unloadable # Send unloadable so it will not be unloaded in development
def new_statuses_allowed_to(user)
statuses = super(user)
if Setting.plugin_redmine_restricted_status &&
Setting.plugin_redmine_restricted_status['restricted_project'].include?(self.project_id.to_s)
return statuses.reject {|s|
Setting.plugin_redmine_restricted_status['allowed_statuses'] &&
Setting.plugin_redmine_restricted_status['allowed_statuses'].include?(s.id.to_s)
}
else
return statuses
end
end
end
end
module ClassMethods
end
module InstanceMethods
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment