Mooooore resources

This commit is contained in:
2014-02-09 05:01:52 -07:00
parent a2cbcac798
commit 2c4cd4a020
7 changed files with 63 additions and 11 deletions

View File

@@ -4,6 +4,7 @@ class Ability
def initialize(user)
can :read, Mac # Anonymous can read mac
can :scan, Mac # Need anonymous so CRON can scan
can :read, Resource
if !user.nil?
@@ -14,7 +15,7 @@ class Ability
can [:update], Mac, :user_id => nil
can [:create,:update], Mac, :user_id => user.id
can :read, Payment, :user_id => user.id
can :read, Resource
can [:create,:update], Resource, :user_id => user.id
can :read, UserCertification, :user_id => user.id
can :read, User, :id => user.id #TODO: why can users update themselves? Maybe because Devise doesn't check users/edit?
can :compose_email, User

View File

@@ -16,6 +16,7 @@ class User < ActiveRecord::Base
has_many :certifications, :through => :user_certifications
has_many :payments
has_many :macs
has_many :resources
validates_format_of [:twitter_url, :facebook_url, :github_url, :website_url], :with => URI::regexp(%w(http https)), :allow_blank => true