<commit_before># Cream

This project aims to assist you in setting up a complete Authentication and Authorization system for your Rails 3 app.

It targets

* [Devise](http://github.com/plataformatec/devise) - Authorization
* [CanCan](http://github.com/ryanb/cancan) - Authentication
* [Roles Generic](http://github.com/kristianmandrup/roles_generic) - Roles

For more advanced Authorization configuration, cream uses cancan-permits to enabel use of Permits and Licenses.
The gems *devise-links* and *cancan-rest-links* provide view helpers to facilitate working with authentication links and model REST links with permission logic.
Cream itself provides generators to easily configure your Rails 3 app with these gems and also includes various view and controller helpers to guard view or controller logic. The project targets a collection of common ORMs for Rails, for both Relational and Document based datastores. 

The objective of this project is to 

* Integrate all these sub-systems
* Provide generators that can auto-configure your Rails 3 app with these sub-systems for a given ORM

_UPDATE_: 1. Dec 2010
Finally all dependency issues have been resolved.
I have tested the 'full_config' generator in a fresh Rails 3.0.3 app and it seems to be working, at least with ORM = 'mongoid' now. 
Time to check with the other ORMs as well and make fixes where needed.

## TODO

The old Demo app [Cream rails 3 app](http://github.com/kristianmandrup/cream-rails3-app) is out of date and needs to be updated!
Any help to create a Demo app is greatly appreciated.

## Status

[CanCan permits demo](https://github.com/kristianmandrup/cancan-permits-demo) is a recent Rails 3 app I created to demonstrate configuration of a Rails 3 app using
*cancan-permits* and *cancan-rest-links*. I will build on this in the near future to provide a full Rails 3 app with all the cream features enabled. 
Stay tuned! Or even better, help me create such template/tutorial projects ;)

### Update Nov 28, 2010

Finally cream again installs from a clean base without any dependency problems :) I just switched to Ruby 1.9.3-dev and tested cream from a clean ruby gems.

## Authentication systems

Cream targets [Devise](http://github.com/plataformatec/devise) as the Authentication system of choice

* [devise](http://github.com/plataformatec/devise) 

### Devise links

The project [devise links](http://github.com/kristianmandrup/devise-links) adds more convenience for creating view links to trigger Devise session actions.

## Authorization system

There is support for the [CanCan](http://github.com/ryanb/cancan) Authorization system. 
I have created a [Cancan permits](http://github.com/kristianmandrup/cancan-permits) gem that adds the concept of Permits for each role (see below).

_Note:_
You are most welcome to provide "plugins" for other permission frameworks!

## Roles

I have developed a flexible *Generic Roles* strategy system.

* [Generic Role Strategies](http://github.com/kristianmandrup/roles_generic)

Roles for popular ORMs

The Roles Generic API has been implemented for the following ORMs

* [Roles Active Record](http://github.com/kristianmandrup/roles_active_record)
* [Roles DataMapper](http://github.com/kristianmandrup/roles_data_mapper)
* [Roles MongoMapper](http://github.com/kristianmandrup/roles_mongo_mapper)
* [Roles Mongoid](http://github.com/kristianmandrup/roles_for_mongoid)
* [Roles Mongoid](http://github.com/kristianmandrup/roles_for_mongoid)
* [Roles Simply Stored](https://github.com/kristianmandrup/roles_simply_stored)

_Role Groups_
Document DBs such as *Mongo* and *Riak* are good for modeling a role-group hierarchical relationship. 
Role-Group support is planned as a future add-on for the roles strategies integration. (Any assistance appreciated!)

_Note:_
You are most welcome to provide "plugins" for any other role frameworks. Please follow the API conventions of Roles generic.

_Update:_
Roles Generic has recently been upgraded with a better API, architecture, framework for testing and more and better functionality. It should also now be more DRY and
easier/simpler to add more strategies and Datastore adapters.

## ORMs

In general, it should now finally be pretty easy to set up a Rails 3 app, with a full Authentication and an Authorization system linked to a Role system using one of the following supported Cream ORMs. 

Relational DB:
* Active Record
* Data Mapper

Document datastores:
* Mongo DB
** Mongo Mapper
** Mongoid
* Couch DB

These ORMs are also supported for the CanCan Permits and Roles systems. 

## Installation and configuration ##

This gem has been designed for Rails 3 only.

### Install gems

Insert <pre>gem 'cream'</pre> in your Rails 3 Gemfile
<pre>$ bundle install</pre>

## Role system

Role strategies can be set up using the [Roles Generic](http://github.com/kristianmandrup/roles_generic) gem or any of the ORM specific roles gems such as [Roles - Active Record](http://github.com/kristianmandrup/roles_active_record). There are currently Roles implementations for the following ORMs:

* Active Record
* Data Mapper
* Mongo Mapper
* Mongoid
* Couch DB (via SimplyStored)

### Update

The Role systems all ORMs (except SimplyStored which is in progress) have recently been upgraded to take advantage of a new Roles Generic API and archictecture. 

## CanCan

Role based authorization for [CanCan](http://github.com/ryanb/cancan) can be done by creating a *Permit* class for each role. 

### Permits

A *Permit* lets a user in a given role do certain actions as defined in the Permit. 
A Permit can also reuse permission logic in the form of Licenses for a more fine grained design if needed. 

CanCan Permits comes with generators to generate Permit files which are placed in '/app/permits'. You can then edit the Permits to suit your needs.

The project [CanCan REST links](http://github.com/kristianmandrup/cancan-rest-links) provides a convenient way to handle CanCan REST links, using a flexible API.

Check out [Cancan permits](http://github.com/kristianmandrup/cancan-permits) for more info for how to use Permits.

*Cancan permits* support all the ORMs that both Devise and Roles Generic support.

### Licenses<commit_msg>updated README with links to new rails 3 demo apps<commit_after># Cream

This project aims to assist you in setting up a complete Authentication and Authorization system for your Rails 3 app.

It targets

* [Devise](http://github.com/plataformatec/devise) - Authorization
* [CanCan](http://github.com/ryanb/cancan) - Authentication
* [Roles Generic](http://github.com/kristianmandrup/roles_generic) - Roles

For more advanced Authorization configuration, cream uses cancan-permits to enabel use of Permits and Licenses.
The gems *devise-links* and *cancan-rest-links* provide view helpers to facilitate working with authentication links and model REST links with permission logic.
Cream itself provides generators to easily configure your Rails 3 app with these gems and also includes various view and controller helpers to guard view or controller logic. The project targets a collection of common ORMs for Rails, for both Relational and Document based datastores. 

The objective of this project is to 

* Integrate all these sub-systems
* Provide generators that can auto-configure your Rails 3 app with these sub-systems for a given ORM

_UPDATE_: 1. Dec 2010
Rhe 'full_config' generator ha snow been tested in a fresh Rails 3.0.3 app and works with the following orms:
* active_record
* mongoid

I will shortly go through the other ORMs and create Rails 3 demo apps for each with instructions.

## Rails 3 demo apps with Cream

The following Rails 3 demo apps use Cream 0.7.7 and above and were created Dec 1. 2010

* [Cream app with Active Record](https://github.com/kristianmandrup/cream-app-active_record) 
* [Cream app with Mongoid](https://github.com/kristianmandrup/cream-app-mongoid) 

## Status

[CanCan permits demo](https://github.com/kristianmandrup/cancan-permits-demo) is a recent Rails 3 app I created to demonstrate configuration of a Rails 3 app using
*cancan-permits* and *cancan-rest-links*. I will build on this in the near future to provide a full Rails 3 app with all the cream features enabled. 
Stay tuned! Or even better, help me create such template/tutorial projects ;)

### Update Nov 28, 2010

Finally cream again installs from a clean base without any dependency problems :) I just switched to Ruby 1.9.3-dev and tested cream from a clean ruby gems.

## Authentication systems

Cream targets [Devise](http://github.com/plataformatec/devise) as the Authentication system of choice

* [devise](http://github.com/plataformatec/devise) 

### Devise links

The project [devise links](http://github.com/kristianmandrup/devise-links) adds more convenience for creating view links to trigger Devise session actions.

## Authorization system

There is support for the [CanCan](http://github.com/ryanb/cancan) Authorization system. 
I have created a [Cancan permits](http://github.com/kristianmandrup/cancan-permits) gem that adds the concept of Permits for each role (see below).

_Note:_
You are most welcome to provide "plugins" for other permission frameworks!

## Roles

I have developed a flexible *Generic Roles* strategy system.

* [Generic Role Strategies](http://github.com/kristianmandrup/roles_generic)

Roles for popular ORMs

The Roles Generic API has been implemented for the following ORMs

* [Roles Active Record](http://github.com/kristianmandrup/roles_active_record)
* [Roles DataMapper](http://github.com/kristianmandrup/roles_data_mapper)
* [Roles MongoMapper](http://github.com/kristianmandrup/roles_mongo_mapper)
* [Roles Mongoid](http://github.com/kristianmandrup/roles_for_mongoid)
* [Roles Mongoid](http://github.com/kristianmandrup/roles_for_mongoid)
* [Roles Simply Stored](https://github.com/kristianmandrup/roles_simply_stored)

_Role Groups_
Document DBs such as *Mongo* and *Riak* are good for modeling a role-group hierarchical relationship. 
Role-Group support is planned as a future add-on for the roles strategies integration. (Any assistance appreciated!)

_Note:_
You are most welcome to provide "plugins" for any other role frameworks. Please follow the API conventions of Roles generic.

_Update:_
Roles Generic has recently been upgraded with a better API, architecture, framework for testing and more and better functionality. It should also now be more DRY and
easier/simpler to add more strategies and Datastore adapters.

## ORMs

In general, it should now finally be pretty easy to set up a Rails 3 app, with a full Authentication and an Authorization system linked to a Role system using one of the following supported Cream ORMs. 

Relational DB:
* Active Record
* Data Mapper

Document datastores:
* Mongo DB
** Mongo Mapper
** Mongoid
* Couch DB

These ORMs are also supported for the CanCan Permits and Roles systems. 

## Installation and configuration ##

This gem has been designed for Rails 3 only.

### Install gems

Insert <pre>gem 'cream'</pre> in your Rails 3 Gemfile
<pre>$ bundle install</pre>

## Role system

Role strategies can be set up using the [Roles Generic](http://github.com/kristianmandrup/roles_generic) gem or any of the ORM specific roles gems such as [Roles - Active Record](http://github.com/kristianmandrup/roles_active_record). There are currently Roles implementations for the following ORMs:

* Active Record
* Data Mapper
* Mongo Mapper
* Mongoid
* Couch DB (via SimplyStored)

_Note_: 
Roles for SimplyStored is "shaky" and works only with the admin_flag strategy. I won't develop more on this particular ORM adapter until requested to do so.
If you need to use Roles with Couch DB, please help implement this adapter, maybe using another (better?) object-mapping solution for Couch DB.

### Update

The Role systems all ORMs (except SimplyStored which is in progress) have recently been upgraded to take advantage of a new Roles Generic API and archictecture. 

## CanCan

Role based authorization for [CanCan](http://github.com/ryanb/cancan) can be done by creating a *Permit* class for each role. 

### Permits

A *Permit* lets a user in a given role do certain actions as defined in the Permit. 
A Permit can also reuse permission logic in the form of Licenses for a more fine grained design if needed. 

CanCan Permits comes with generators to generate Permit files which are placed in '/app/permits'. You can then edit the Permits to suit your needs.

The project [CanCan REST links](http://github.com/kristianmandrup/cancan-rest-links) provides a convenient way to handle CanCan REST links, using a flexible API.

Check out [Cancan permits](http://github.com/kristianmandrup/cancan-permits) for more info for how to use Permits.

*Cancan permits* support all the ORMs that both Devise and Roles Generic support.

### Licenses
{'fraction_non_alphanumeric': 0.06983805668016195, 'fraction_numerical': 0.005138586110246029, 'mean_word_length': 4.711427301022677, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1404161', 'n_tokens_mistral': 3775, 'n_tokens_neox': 3573, 'n_words': 1638}