IPN improvements
This commit is contained in:
@@ -3,14 +3,20 @@ class Ability
|
||||
|
||||
def initialize(user)
|
||||
# Anonymous can read mac
|
||||
can :read, Mac
|
||||
today = Date.today
|
||||
event = Date.new(2013,9,1)
|
||||
|
||||
unless today == event
|
||||
can :read, Mac
|
||||
can :scan, Mac # Need anonymous so CRON can scan
|
||||
end
|
||||
|
||||
if !user.nil?
|
||||
|
||||
# By default, users can only see their own stuff
|
||||
can :read, Card, :user_id => user.id
|
||||
can :read, Certification
|
||||
can :read_details, Mac
|
||||
can :read_details, Mac unless today == event
|
||||
can [:update], Mac, :user_id => nil
|
||||
can [:create,:update], Mac, :user_id => user.id
|
||||
can :read, User, :id => user.id #TODO: why can users update themselves?
|
||||
|
||||
@@ -86,7 +86,7 @@ class User < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def self.member_levels
|
||||
{25 => "Associate", 50 => "Basic", 100 => "Plus"}
|
||||
{25 => "Associate", 50 => "Basic", 75 => "Basic", 100 => "Plus"}
|
||||
end
|
||||
|
||||
def member_status
|
||||
@@ -144,7 +144,7 @@ class User < ActiveRecord::Base
|
||||
# There are payments
|
||||
if self.payments.count > 0 then
|
||||
# They're on time
|
||||
if self.payments.last.date > (DateTime.now - 45.days)
|
||||
if self.payments.last.date > (DateTime.now - 60.days)
|
||||
flair = "-paid"
|
||||
else
|
||||
message = "Last Payment #{(DateTime.now - self.payments.last.date).to_i/30} months ago"
|
||||
|
||||
Reference in New Issue
Block a user