Plugin Permission Issues (Rails? Ruby?)
Added by Brigette Swan over 15 years ago
I've been working on a very basic plugin for Redmine. Well, the plugin was working perfectly fine, at least, I thought. Except that, it comes up regardless of whether or not the module is actually checked on the project options menu thing. And then I tried to specify permissions - you know, creating the checkboxes so that some people could see or edit, and some couldn't. And much like the basic module load, those didn't work either.
I followed the tutorial, I looked at some of the other plugins that, you know, work properly.... I still haven't figured out what's wrong.
I'm wondering if anyone else is having this issue, or has had it in the past, or could at least recognize where it's coming from, or something I haven't done - as it's not generating errors or the like, and it does perform its function.....its functionality is just 'mandatory', if you will.
I do realize that my Ruby version is out of date, and I'm trying to update it now, but the strangest issue is, the other plugins I've tried have permissions that work, so I don't think it's that, really. (But I could certainly be wrong.) It's just.....weird, I guess.
Redmine: 0.8.4
Rails: 2.1.2
Ruby: 1.8.5
OS: Linux
Database: MySQL
Server: Mongrel
Any input would be appreciated. Thanks!
Replies (3)
RE: Plugin Permission Issues (Rails? Ruby?) - Added by Eric Davis over 15 years ago
Could you share some of it's code, maybe it's not triggering the permissions correctly. The init.rb
and any controllers should be enough.
Eric Davis
RE: Plugin Permission Issues (Rails? Ruby?) - Added by Brigette Swan about 15 years ago
Sorry for the delay, I've been really busy.
Here is my init.rb file...
require 'redmine' require 'calendar_text_builder' require 'calendar_helper' Redmine::Plugin.register :redmine_icalendar do name 'Redmine Calendar Plugin' author 'Brigette Swan' description '...' version '0.0.1' project_module :redmine_icalendar do permission :redmine_icalendar, {:redmine_icalendar => [:index, :show, :list]}, :public => true permission :redmine_icalendar, {:redmine_icalendar => [:edit, :new, :destroy]}, :require => :member end menu :project_menu, :icalendar, {:controller => 'calendar_admin', :action => 'index'}, :caption => 'Calendar', :param => :id
I did the routes and stuff at the bottom and those worked fine, so I didn't include them.
As for the only controller, the top looks like this...
class CalendarAdminController < ApplicationController unloadable before_filter :find_project, :only => [:index, :list, :new, :calendar] before_filter :find_event, :only => [:show, :edit], :except => [:index, :list, :new, :calendar] before_filter :authorize
I didn't feel comfortable showing the whole thing yet, but if there's something I need to do in the controller functions....well, that's probably the issue, since I didn't really add anything there related to authorization or permissions.
RE: Plugin Permission Issues (Rails? Ruby?) - Added by Eric Davis about 15 years ago
I think this is the problem:
project_module :redmine_icalendar do
permission :redmine_icalendar, {:redmine_icalendar => [:index, :show, :list]}, :public => true
permission :redmine_icalendar, {:redmine_icalendar => [:edit, :new, :destroy]}, :require => :member
end
- You are defining a permission called
:redmine_icalendar
twice, you should pick a second name for the other (:edit_icalendar ?) - This chunk
{:redmine_icalendar => [:index, :show, :list]}
is mapping the permission to theRedmineIcalendar
controller and not yourCalendarAdminController
.
Try:
project_module :redmine_icalendar do
permission :view_redmine_icalendar, {:calendar_admin => [:index, :show, :list]}, :public => true
permission :edit_redmine_icalendar, {:calendar_admin => [:edit, :new, :destroy]}, :require => :member
end
Eric Davis