Module: Authorization::People::V1::User
- Defined in:
- lib/generators/people/authorizations/templates/authorization.rb
Class Method Summary collapse
- .destroy?(targetUser, tokenUser) ⇒ Boolean
- .include_attempts?(current_user, user_object, options) ⇒ Boolean
- .include_confirmed?(current_user, user_object, options) ⇒ Boolean
- .include_created_at?(current_user, user_object, options) ⇒ Boolean
- .include_email?(current_user, user_object, options) ⇒ Boolean
-
.include_id?(current_user, user_object, options) ⇒ Boolean
Used in the serializer, current_user may be nil.
- .include_locked?(current_user, user_object, options) ⇒ Boolean
- .include_password_digest?(current_user, user_object, options) ⇒ Boolean
- .include_tokens?(current_user, user_object, options) ⇒ Boolean
- .include_updated_at?(current_user, user_object, options) ⇒ Boolean
- .include_username?(current_user, user_object, options) ⇒ Boolean
-
.index?(tokenUser) ⇒ Boolean
Used in the controller.
- .show?(targetUser, tokenUser) ⇒ Boolean
- .update?(targetUser, tokenUser) ⇒ Boolean
Class Method Details
.destroy?(targetUser, tokenUser) ⇒ Boolean
26 27 28 29 30 31 32 33 |
# File 'lib/generators/people/authorizations/templates/authorization.rb', line 26 def self.destroy?(targetUser,tokenUser) if targetUser != tokenUser #Can only destroy your own data return false else return true end end |
.include_attempts?(current_user, user_object, options) ⇒ Boolean
67 68 69 70 71 |
# File 'lib/generators/people/authorizations/templates/authorization.rb', line 67 def self.include_attempts?(current_user,user_object,) action = [:url_options][:_recall][:action] controller = [:url_options][:_recall][:controller] return false end |
.include_confirmed?(current_user, user_object, options) ⇒ Boolean
61 62 63 64 65 |
# File 'lib/generators/people/authorizations/templates/authorization.rb', line 61 def self.include_confirmed?(current_user,user_object,) action = [:url_options][:_recall][:action] controller = [:url_options][:_recall][:controller] return false end |
.include_created_at?(current_user, user_object, options) ⇒ Boolean
79 80 81 82 83 |
# File 'lib/generators/people/authorizations/templates/authorization.rb', line 79 def self.include_created_at?(current_user,user_object,) action = [:url_options][:_recall][:action] controller = [:url_options][:_recall][:controller] return true end |
.include_email?(current_user, user_object, options) ⇒ Boolean
43 44 45 46 47 |
# File 'lib/generators/people/authorizations/templates/authorization.rb', line 43 def self.include_email?(current_user,user_object,) action = [:url_options][:_recall][:action] controller = [:url_options][:_recall][:controller] return true end |
.include_id?(current_user, user_object, options) ⇒ Boolean
Used in the serializer, current_user may be nil
37 38 39 40 41 |
# File 'lib/generators/people/authorizations/templates/authorization.rb', line 37 def self.include_id?(current_user,user_object,) action = [:url_options][:_recall][:action] controller = [:url_options][:_recall][:controller] return true end |
.include_locked?(current_user, user_object, options) ⇒ Boolean
73 74 75 76 77 |
# File 'lib/generators/people/authorizations/templates/authorization.rb', line 73 def self.include_locked?(current_user,user_object,) action = [:url_options][:_recall][:action] controller = [:url_options][:_recall][:controller] return false end |
.include_password_digest?(current_user, user_object, options) ⇒ Boolean
55 56 57 58 59 |
# File 'lib/generators/people/authorizations/templates/authorization.rb', line 55 def self.include_password_digest?(current_user,user_object,) action = [:url_options][:_recall][:action] controller = [:url_options][:_recall][:controller] return false end |
.include_tokens?(current_user, user_object, options) ⇒ Boolean
92 93 94 95 96 97 98 99 |
# File 'lib/generators/people/authorizations/templates/authorization.rb', line 92 def self.include_tokens?(current_user,user_object,) action = [:url_options][:_recall][:action] controller = [:url_options][:_recall][:controller] #if action == "index" && controller == "people/api/v1/users" #return false #end return false end |
.include_updated_at?(current_user, user_object, options) ⇒ Boolean
85 86 87 88 89 |
# File 'lib/generators/people/authorizations/templates/authorization.rb', line 85 def self.include_updated_at?(current_user,user_object,) action = [:url_options][:_recall][:action] controller = [:url_options][:_recall][:controller] return true end |
.include_username?(current_user, user_object, options) ⇒ Boolean
49 50 51 52 53 |
# File 'lib/generators/people/authorizations/templates/authorization.rb', line 49 def self.include_username?(current_user,user_object,) action = [:url_options][:_recall][:action] controller = [:url_options][:_recall][:controller] return true end |
.index?(tokenUser) ⇒ Boolean
Used in the controller
8 9 10 |
# File 'lib/generators/people/authorizations/templates/authorization.rb', line 8 def self.index?(tokenUser) return true end |
.show?(targetUser, tokenUser) ⇒ Boolean
12 13 14 |
# File 'lib/generators/people/authorizations/templates/authorization.rb', line 12 def self.show?(targetUser,tokenUser) return true end |
.update?(targetUser, tokenUser) ⇒ Boolean
17 18 19 20 21 22 23 24 |
# File 'lib/generators/people/authorizations/templates/authorization.rb', line 17 def self.update?(targetUser,tokenUser) if targetUser != tokenUser #Can only update your own data return false else return true end end |