+ def access_token_for_user(user)
+ unless token = access_tokens.find(:first, :conditions => { :user_id => user.id, :invalidated_at => nil })
+ params = { :user => user }
+
+ permissions.each do |p|
+ params[p] = true
+ end
+
+ token = access_tokens.create(params)
+ end
+
+ token
+ end
+