<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Rails Authorization Plugin</title>
	<atom:link href="http://blog.gingertech.net/2008/05/21/rails-authorization-plugin/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.gingertech.net/2008/05/21/rails-authorization-plugin/</link>
	<description>Silvia&#039;s blog</description>
	<lastBuildDate>Fri, 03 Feb 2012 22:04:19 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
	<item>
		<title>By: Balaji</title>
		<link>http://blog.gingertech.net/2008/05/21/rails-authorization-plugin/comment-page-1/#comment-6304</link>
		<dc:creator>Balaji</dc:creator>
		<pubDate>Sun, 27 Jun 2010 12:57:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.gingertech.net/2008/05/21/rails-authorization-plugin/#comment-6304</guid>
		<description>Hi

Can someone provide me a sample data for the role and  roles_user table? I dont understand the authorizable id and authorizable type 

Thanks</description>
		<content:encoded><![CDATA[<p>Hi</p>
<p>Can someone provide me a sample data for the role and  roles_user table? I dont understand the authorizable id and authorizable type </p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: silvia</title>
		<link>http://blog.gingertech.net/2008/05/21/rails-authorization-plugin/comment-page-1/#comment-758</link>
		<dc:creator>silvia</dc:creator>
		<pubDate>Sun, 04 Jan 2009 11:15:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.gingertech.net/2008/05/21/rails-authorization-plugin/#comment-758</guid>
		<description>Hi DJ,

initially, the tables are indeed empty. I have created an insert into the table in my migration. It looks something like this:

  def self.up
    create_table :roles_users, :id =&gt; false do &#124;t&#124;
      t.integer :user_id, :role_id
      t.timestamps # creates updated_at and created_at
    end

    create_table :roles do &#124;t&#124;
      t.string  :name, :authorizable_type, :limit =&gt; 40
      t.integer :authorizable_id
      t.timestamps
    end

    # insert a siteadmin user for admins with role site_admin
    siteadmin = User.new({:nick =&gt; &#039;siteadmin&#039;,
                         :email =&gt; &#039;admin@example.com&#039;,
                         :password =&gt; &#039;example&#039;,
                         :firstname =&gt; &quot;Site&quot;,
                         :lastname =&gt; &quot;admin&quot;})
    siteadmin.has_role &#039;site_admin&#039;
  end

Hope this helps.</description>
		<content:encoded><![CDATA[<p>Hi DJ,</p>
<p>initially, the tables are indeed empty. I have created an insert into the table in my migration. It looks something like this:</p>
<p>  def self.up<br />
    create_table :roles_users, :id => false do |t|<br />
      t.integer :user_id, :role_id<br />
      t.timestamps # creates updated_at and created_at<br />
    end</p>
<p>    create_table :roles do |t|<br />
      t.string  :name, :authorizable_type, :limit => 40<br />
      t.integer :authorizable_id<br />
      t.timestamps<br />
    end</p>
<p>    # insert a siteadmin user for admins with role site_admin<br />
    siteadmin = User.new({:nick => &#8216;siteadmin&#8217;,<br />
                         :email => &#8216;admin@example.com&#8217;,<br />
                         :password => &#8216;example&#8217;,<br />
                         :firstname => &#8220;Site&#8221;,<br />
                         :lastname => &#8220;admin&#8221;})<br />
    siteadmin.has_role &#8216;site_admin&#8217;<br />
  end</p>
<p>Hope this helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: silvia</title>
		<link>http://blog.gingertech.net/2008/05/21/rails-authorization-plugin/comment-page-1/#comment-757</link>
		<dc:creator>silvia</dc:creator>
		<pubDate>Sun, 04 Jan 2009 11:11:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.gingertech.net/2008/05/21/rails-authorization-plugin/#comment-757</guid>
		<description>Hi Archie

ups, I just noticed I never replied to your post.

# how do you restrict a teacher to his or her school only?
This should work:
teacher.has_role </description>
		<content:encoded><![CDATA[<p>Hi Archie</p>
<p>ups, I just noticed I never replied to your post.</p>
<p># how do you restrict a teacher to his or her school only?<br />
This should work:<br />
teacher.has_role</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DJ</title>
		<link>http://blog.gingertech.net/2008/05/21/rails-authorization-plugin/comment-page-1/#comment-746</link>
		<dc:creator>DJ</dc:creator>
		<pubDate>Tue, 23 Dec 2008 05:16:05 +0000</pubDate>
		<guid isPermaLink="false">http://blog.gingertech.net/2008/05/21/rails-authorization-plugin/#comment-746</guid>
		<description>Hi
    silvia
               Nice tutorial as you pointed out for both the model User and Account, and usage of acts_as_authorized_user and acts_as_authorizable as both of this will create some methods by which authorization can be done and even can be set in a model class, Now one thing that baffling me is after db:migrate the tables roles and roles_user becomes empty, so whether i need to manually enter the roles in the database or if not is there any GUI by which i can assign roles for each user ?

DJ</description>
		<content:encoded><![CDATA[<p>Hi<br />
    silvia<br />
               Nice tutorial as you pointed out for both the model User and Account, and usage of acts_as_authorized_user and acts_as_authorizable as both of this will create some methods by which authorization can be done and even can be set in a model class, Now one thing that baffling me is after db:migrate the tables roles and roles_user becomes empty, so whether i need to manually enter the roles in the database or if not is there any GUI by which i can assign roles for each user ?</p>
<p>DJ</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Archie</title>
		<link>http://blog.gingertech.net/2008/05/21/rails-authorization-plugin/comment-page-1/#comment-622</link>
		<dc:creator>Archie</dc:creator>
		<pubDate>Tue, 15 Jul 2008 09:33:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.gingertech.net/2008/05/21/rails-authorization-plugin/#comment-622</guid>
		<description>Hi Sylvia

Thanks for your efforts to throw more clarity on the use of this plugin.  I am still trying to wrap my mind around this. For my application I am particulary interested in authorisation for specific model objects and would appreciate your advice on how to go about it.
To start off with I have the following scenario:

School Model:
has_many : teaching_posts #teachers employed

TeachingPost model: #users with &#039;teacher&#039; and/or &#039;school_admin&#039; role
has_many: registration_classes # a teacher responsible for a specific classroom of students
belongs_to :school, :user
# how do you restrict a teacher to his or her school only?
# how do you allow a &#039;school_admin&#039; for school A only?

RegistrationClass Model #attributes name, teaching_post_id, start_date, end_date 
has_many :student_admissions
belongs_to : teaching_post
# how do you restrict a teacher to his or her own class only etc. ?

StudentAdmission model: #users with &#039;student&#039; role
belongs_to :user, :registration_class 

A user may have one or more of the following roles
admin #super admin
&#039;school_admin&#039; #admin for a specific school only
&#039;teacher&#039; # for a specific school only
&#039;student&#039; # for a specific school only

I hope you can see where I am going with this. I would appreciate any help.
Thanks</description>
		<content:encoded><![CDATA[<p>Hi Sylvia</p>
<p>Thanks for your efforts to throw more clarity on the use of this plugin.  I am still trying to wrap my mind around this. For my application I am particulary interested in authorisation for specific model objects and would appreciate your advice on how to go about it.<br />
To start off with I have the following scenario:</p>
<p>School Model:<br />
has_many : teaching_posts #teachers employed</p>
<p>TeachingPost model: #users with &#8216;teacher&#8217; and/or &#8216;school_admin&#8217; role<br />
has_many: registration_classes # a teacher responsible for a specific classroom of students<br />
belongs_to :school, :user<br />
# how do you restrict a teacher to his or her school only?<br />
# how do you allow a &#8216;school_admin&#8217; for school A only?</p>
<p>RegistrationClass Model #attributes name, teaching_post_id, start_date, end_date<br />
has_many :student_admissions<br />
belongs_to : teaching_post<br />
# how do you restrict a teacher to his or her own class only etc. ?</p>
<p>StudentAdmission model: #users with &#8216;student&#8217; role<br />
belongs_to :user, :registration_class </p>
<p>A user may have one or more of the following roles<br />
admin #super admin<br />
&#8216;school_admin&#8217; #admin for a specific school only<br />
&#8216;teacher&#8217; # for a specific school only<br />
&#8216;student&#8217; # for a specific school only</p>
<p>I hope you can see where I am going with this. I would appreciate any help.<br />
Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yardboy</title>
		<link>http://blog.gingertech.net/2008/05/21/rails-authorization-plugin/comment-page-1/#comment-621</link>
		<dc:creator>Yardboy</dc:creator>
		<pubDate>Fri, 11 Jul 2008 16:33:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.gingertech.net/2008/05/21/rails-authorization-plugin/#comment-621</guid>
		<description>Mike - 

I think this plugin, great as it is, is indeed overkill for your situation. If you use restful_authentication plugin to generate your auth system, all you&#039;ll have to do is add an :auth attribute to the user model and a few lines of code to the generated lib/authenticated_system.rb to end up with:

.admin?, .super? .clerk? methods on user model (to be used anywhere needed)

admin_required, super_required, clerk_required methods (to be used in before_filters)

c.</description>
		<content:encoded><![CDATA[<p>Mike &#8211; </p>
<p>I think this plugin, great as it is, is indeed overkill for your situation. If you use restful_authentication plugin to generate your auth system, all you&#8217;ll have to do is add an :auth attribute to the user model and a few lines of code to the generated lib/authenticated_system.rb to end up with:</p>
<p>.admin?, .super? .clerk? methods on user model (to be used anywhere needed)</p>
<p>admin_required, super_required, clerk_required methods (to be used in before_filters)</p>
<p>c.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mikhailov</title>
		<link>http://blog.gingertech.net/2008/05/21/rails-authorization-plugin/comment-page-1/#comment-614</link>
		<dc:creator>mikhailov</dc:creator>
		<pubDate>Wed, 02 Jul 2008 09:49:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.gingertech.net/2008/05/21/rails-authorization-plugin/#comment-614</guid>
		<description>To developer:
Would you like to extend this great plugin folowed string:

private
  def get_role
   [.......]   include =&gt; :roles_user 
  end</description>
		<content:encoded><![CDATA[<p>To developer:<br />
Would you like to extend this great plugin folowed string:</p>
<p>private<br />
  def get_role<br />
   [.......]   include =&gt; :roles_user<br />
  end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: silvia</title>
		<link>http://blog.gingertech.net/2008/05/21/rails-authorization-plugin/comment-page-1/#comment-601</link>
		<dc:creator>silvia</dc:creator>
		<pubDate>Thu, 12 Jun 2008 04:41:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog.gingertech.net/2008/05/21/rails-authorization-plugin/#comment-601</guid>
		<description>As mentioned in the article, roles can be set on one of the following three scopes:

    * entire application (no class or object specified)
    * model class
    * an instance of a model (i.e., a model object)

So, yes, you can give users specific roles application-wide - just leave away the model name in most of the above commands and you will be set. In your controllers, you can then use the permit command to get your methods. See http://www.billkatz.com/authorization for more information on how to use the permit command.

Whether this is overkill, I cannot tell you. It&#039;s more of a question whether you&#039;d like to use and trust other people&#039;s plugin code or prefer to write your own. IMO, in the long run, if you choose a supported plugin, it will be worth the time spent on it.</description>
		<content:encoded><![CDATA[<p>As mentioned in the article, roles can be set on one of the following three scopes:</p>
<p>    * entire application (no class or object specified)<br />
    * model class<br />
    * an instance of a model (i.e., a model object)</p>
<p>So, yes, you can give users specific roles application-wide &#8211; just leave away the model name in most of the above commands and you will be set. In your controllers, you can then use the permit command to get your methods. See <a href="http://www.billkatz.com/authorization" rel="nofollow">http://www.billkatz.com/authorization</a> for more information on how to use the permit command.</p>
<p>Whether this is overkill, I cannot tell you. It&#8217;s more of a question whether you&#8217;d like to use and trust other people&#8217;s plugin code or prefer to write your own. IMO, in the long run, if you choose a supported plugin, it will be worth the time spent on it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://blog.gingertech.net/2008/05/21/rails-authorization-plugin/comment-page-1/#comment-600</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Thu, 12 Jun 2008 04:32:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.gingertech.net/2008/05/21/rails-authorization-plugin/#comment-600</guid>
		<description>I see.  So is it possible to have a User Role without the need to specify an object?  For instance, I have an amazingly simple application that calls for 3 roles: Admin, Supervisor, Clerk.  I have 2 controllers: UserContoller, InformationController.

Based on the user&#039;s role, I will allow or deny access to creation, deletion, edit, etc.  I have no need to place permissions on objects, rather, I need to allow/disallow access to specific controller functionality.  No more, no less.

Can this plugin easily handle that or is it overkill?

Thanks.</description>
		<content:encoded><![CDATA[<p>I see.  So is it possible to have a User Role without the need to specify an object?  For instance, I have an amazingly simple application that calls for 3 roles: Admin, Supervisor, Clerk.  I have 2 controllers: UserContoller, InformationController.</p>
<p>Based on the user&#8217;s role, I will allow or deny access to creation, deletion, edit, etc.  I have no need to place permissions on objects, rather, I need to allow/disallow access to specific controller functionality.  No more, no less.</p>
<p>Can this plugin easily handle that or is it overkill?</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: silvia</title>
		<link>http://blog.gingertech.net/2008/05/21/rails-authorization-plugin/comment-page-1/#comment-599</link>
		<dc:creator>silvia</dc:creator>
		<pubDate>Thu, 12 Jun 2008 00:40:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.gingertech.net/2008/05/21/rails-authorization-plugin/#comment-599</guid>
		<description>Hi Mike,

Thanks for pointing out that I didn&#039;t really describe what I was doing. The &quot;Account&quot; is and example model that I used for describing how to make use of the users and their roles. In your application I&#039;m sure you will want to use some other model to restrict user access based on roles. Accounts is my example.

Hope this helps.</description>
		<content:encoded><![CDATA[<p>Hi Mike,</p>
<p>Thanks for pointing out that I didn&#8217;t really describe what I was doing. The &#8220;Account&#8221; is and example model that I used for describing how to make use of the users and their roles. In your application I&#8217;m sure you will want to use some other model to restrict user access based on roles. Accounts is my example.</p>
<p>Hope this helps.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

