Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Basic member/resource permission system for ActiveRecord objects.
Ruby
tag: v0.0.1

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.document
.gitignore
LICENSE
README.rdoc
Rakefile
VERSION
init.rb
permissable.gemspec

README.rdoc

permissable

Permissable creates the ability to add a permissions system to “resources” based on a “member”. It allows you to define a member using the permissable method:

class User < ActiveRecord::Base permissable do |configure| configure.permission_for :read, :posts, :categories configure.permission_for [:read, :write, :moderate], :comments end end

Permissable uses a single “permissions” table (and subsuquently a Permission model), with a polymorphic relationship between both the member and the resource.

Important to know… This is my first attempt at a RubyGem. I'm using the gem itself for an application currently in development, so you can be assured at least the basic functionality should work as it goes along. For the time being, I'm not writing any tests, but there will be some later.

I decided to develop it because I couldn't find anything that achieved the same thing that didn't seem cumbersome or akward to configure.

This documention is incomplete… I'll add more later.

Usage

class User < ActiveRecord::Base permissable do |configure| configure.permission_for :read, :posts, :categories configure.permission_for [:read, :write, :moderate], :comments end end

The permissable method accepts a block containing permission declarations. Each call to permission_for accepts two attributes.

  • method: The permission you want to assign (read, write, moderate, etc)

  • resources: A list of resources to assign those permissions to

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don't break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Copyright

Copyright © 2010 kurb media, llc. See LICENSE for details.

Something went wrong with that request. Please try again.