Module: Marley::Plugins::CurrentUserMethods::ClassMethods

Defined in:
lib/marley/joints/user.rb

Instance Method Summary collapse

Instance Method Details

#authorize_rest_delete(meth) ⇒ Object



33
# File 'lib/marley/joints/user.rb', line 33

def authorize_rest_delete(meth):false; end

#authorize_rest_get(meth) ⇒ Object



26
27
28
# File 'lib/marley/joints/user.rb', line 26

def authorize_rest_get(meth)
  model_actions[:get].to_a.include?(meth.to_sym) && !current_user.new?
end

#authorize_rest_post(meth) ⇒ Object



29
30
31
# File 'lib/marley/joints/user.rb', line 29

def authorize_rest_post(meth)
  new(($request[:post_params][resource_name.to_sym]||{}).reject {|k,v| v.nil?}).current_user_role=='owner' && meth.nil?
end

#authorize_rest_put(meth) ⇒ Object



32
# File 'lib/marley/joints/user.rb', line 32

def authorize_rest_put(meth);false; end

#current_userObject



22
# File 'lib/marley/joints/user.rb', line 22

def current_user; $request && $request[:user]; end

#current_user_classObject



23
# File 'lib/marley/joints/user.rb', line 23

def current_user_class; current_user.class; end

#current_user_dsObject



24
# File 'lib/marley/joints/user.rb', line 24

def current_user_ds; filter("#{table_name}__#{@owner_col}".to_sym => current_user[:id]); end

#requires_user?(verb = nil, meth = nil) ⇒ Boolean

Returns:

  • (Boolean)


25
# File 'lib/marley/joints/user.rb', line 25

def requires_user?(verb=nil,meth=nil);true;end