Friday, June 1, 2012

Creating new User Type (ability)


  1. Create entry for new access level in database. Probably the best way to do this is via rails console.The only fields that need to be defined are :name and :display_name. :name should have no spaces. For this discussion, assume the new access level is named TempUser.
  2. Create ability in relevant model for organization, e.g. app/models/residence_life_organization.rb. There is a naming convention that must be followed when creating ability. The ability should be the singularized, tableized value of :name field (See Step 1 above). For example, the ability for TempUser should be temp_user. (Note: a tableized name is a name separated at upper-case letters with inserted underscores). If you fail to correctly define the ability name, you will see a message like:
  3. No role for cs.temp@smumn.edu in Residence Life
    in the log.
  4. Give :assign abilities to appropriate administrative users. Currently, administrator and system administrator can create (assign) new users in organizations. These changes are also made in organizational abilities file, e.g. app/models/residence_life_organization.rb.
  5. Give :create, :update, :destroy abilities to appropriate administrative users. These changes are also made in organizational abilities file, e.g. app/models/residence_life_organization.rb.