souls 0.24.2 → 0.24.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. checksums.yaml +4 -4
  2. data/lib/souls/version.rb +1 -1
  3. metadata +2 -191
  4. data/.gitignore +0 -15
  5. data/.irbrc +0 -3
  6. data/.rspec +0 -3
  7. data/.rubocop.yml +0 -152
  8. data/.ruby-version +0 -1
  9. data/.travis.yml +0 -6
  10. data/Gemfile +0 -13
  11. data/Gemfile.lock +0 -98
  12. data/Rakefile +0 -23
  13. data/Steepfile +0 -8
  14. data/apps/api/.env.sample +0 -7
  15. data/apps/api/.gitignore +0 -32
  16. data/apps/api/.irbrc +0 -4
  17. data/apps/api/.rspec +0 -3
  18. data/apps/api/.rubocop.yml +0 -132
  19. data/apps/api/.ruby-version +0 -1
  20. data/apps/api/CODE_OF_CONDUCT.md +0 -74
  21. data/apps/api/Dockerfile +0 -16
  22. data/apps/api/Dockerfile.dev +0 -17
  23. data/apps/api/Gemfile +0 -50
  24. data/apps/api/Gemfile.lock +0 -412
  25. data/apps/api/LICENSE.txt +0 -67
  26. data/apps/api/Procfile +0 -2
  27. data/apps/api/Procfile.dev +0 -2
  28. data/apps/api/README.md +0 -37
  29. data/apps/api/Rakefile +0 -5
  30. data/apps/api/app.rb +0 -114
  31. data/apps/api/app/engines/notification_engine.rb +0 -5
  32. data/apps/api/app/graphql/mutations/.keep +0 -0
  33. data/apps/api/app/graphql/mutations/base/article/create_article.rb +0 -30
  34. data/apps/api/app/graphql/mutations/base/article/delete_article.rb +0 -17
  35. data/apps/api/app/graphql/mutations/base/article/destroy_delete_article.rb +0 -17
  36. data/apps/api/app/graphql/mutations/base/article/update_article.rb +0 -30
  37. data/apps/api/app/graphql/mutations/base/article_category/create_article_category.rb +0 -21
  38. data/apps/api/app/graphql/mutations/base/article_category/delete_article_category.rb +0 -17
  39. data/apps/api/app/graphql/mutations/base/article_category/destroy_delete_article_category.rb +0 -17
  40. data/apps/api/app/graphql/mutations/base/article_category/update_article_category.rb +0 -21
  41. data/apps/api/app/graphql/mutations/base/user/create_user.rb +0 -31
  42. data/apps/api/app/graphql/mutations/base/user/delete_user.rb +0 -17
  43. data/apps/api/app/graphql/mutations/base/user/destroy_delete_user.rb +0 -17
  44. data/apps/api/app/graphql/mutations/base/user/update_user.rb +0 -31
  45. data/apps/api/app/graphql/mutations/base_mutation.rb +0 -65
  46. data/apps/api/app/graphql/mutations/managers/user_manager/add_user_role.rb +0 -22
  47. data/apps/api/app/graphql/mutations/managers/user_manager/remove_user_role.rb +0 -22
  48. data/apps/api/app/graphql/mutations/managers/user_manager/sign_in_user.rb +0 -45
  49. data/apps/api/app/graphql/queries/article.rb +0 -13
  50. data/apps/api/app/graphql/queries/article_categories.rb +0 -11
  51. data/apps/api/app/graphql/queries/article_category.rb +0 -13
  52. data/apps/api/app/graphql/queries/articles.rb +0 -11
  53. data/apps/api/app/graphql/queries/base_query.rb +0 -12
  54. data/apps/api/app/graphql/queries/me.rb +0 -11
  55. data/apps/api/app/graphql/queries/user.rb +0 -13
  56. data/apps/api/app/graphql/queries/users.rb +0 -11
  57. data/apps/api/app/graphql/resolvers/article_category_search.rb +0 -41
  58. data/apps/api/app/graphql/resolvers/article_search.rb +0 -57
  59. data/apps/api/app/graphql/resolvers/base.rb +0 -17
  60. data/apps/api/app/graphql/resolvers/user_search.rb +0 -63
  61. data/apps/api/app/graphql/souls_api_schema.rb +0 -43
  62. data/apps/api/app/graphql/types/.keep +0 -0
  63. data/apps/api/app/graphql/types/article_category_type.rb +0 -12
  64. data/apps/api/app/graphql/types/article_type.rb +0 -30
  65. data/apps/api/app/graphql/types/base/base_argument.rb +0 -4
  66. data/apps/api/app/graphql/types/base/base_enum.rb +0 -4
  67. data/apps/api/app/graphql/types/base/base_field.rb +0 -5
  68. data/apps/api/app/graphql/types/base/base_input_object.rb +0 -5
  69. data/apps/api/app/graphql/types/base/base_interface.rb +0 -7
  70. data/apps/api/app/graphql/types/base/base_object.rb +0 -6
  71. data/apps/api/app/graphql/types/base/base_scalar.rb +0 -4
  72. data/apps/api/app/graphql/types/base/base_union.rb +0 -4
  73. data/apps/api/app/graphql/types/base/mutation_type.rb +0 -26
  74. data/apps/api/app/graphql/types/base/query_type.rb +0 -18
  75. data/apps/api/app/graphql/types/connections/article_category_connection.rb +0 -3
  76. data/apps/api/app/graphql/types/connections/article_connection.rb +0 -3
  77. data/apps/api/app/graphql/types/connections/base_connection.rb +0 -14
  78. data/apps/api/app/graphql/types/connections/user_connection.rb +0 -3
  79. data/apps/api/app/graphql/types/edges/article_category_edge.rb +0 -5
  80. data/apps/api/app/graphql/types/edges/article_edge.rb +0 -5
  81. data/apps/api/app/graphql/types/edges/base_edge.rb +0 -4
  82. data/apps/api/app/graphql/types/edges/user_edge.rb +0 -5
  83. data/apps/api/app/graphql/types/user_type.rb +0 -24
  84. data/apps/api/app/models/article.rb +0 -4
  85. data/apps/api/app/models/article_category.rb +0 -3
  86. data/apps/api/app/models/user.rb +0 -19
  87. data/apps/api/app/policies/application_policy.rb +0 -40
  88. data/apps/api/app/policies/article_category_policy.rb +0 -31
  89. data/apps/api/app/policies/article_policy.rb +0 -31
  90. data/apps/api/app/policies/user_policy.rb +0 -35
  91. data/apps/api/app/utils/association_loader.rb +0 -50
  92. data/apps/api/app/utils/fire_store.rb +0 -9
  93. data/apps/api/app/utils/firebase_id_token.rb +0 -4
  94. data/apps/api/app/utils/json_web_token.rb +0 -13
  95. data/apps/api/app/utils/record_loader.rb +0 -10
  96. data/apps/api/app/utils/souls_helper.rb +0 -18
  97. data/apps/api/cloudbuild.yml +0 -32
  98. data/apps/api/config.ru +0 -17
  99. data/apps/api/config/database.yml +0 -33
  100. data/apps/api/config/souls.rb +0 -10
  101. data/apps/api/constants/areas.rb +0 -71
  102. data/apps/api/constants/column_name_ja.rb +0 -27
  103. data/apps/api/db/migrate/20200006095538_create_users.rb +0 -30
  104. data/apps/api/db/migrate/20200712180236_create_article_categories.rb +0 -12
  105. data/apps/api/db/migrate/20200714215521_create_articles.rb +0 -22
  106. data/apps/api/db/schema.rb +0 -78
  107. data/apps/api/db/seeds.rb +0 -44
  108. data/apps/api/github/workflows/delivery.yml +0 -81
  109. data/apps/api/log/.keep +0 -0
  110. data/apps/api/spec/factories/article_categories.rb +0 -9
  111. data/apps/api/spec/factories/articles.rb +0 -17
  112. data/apps/api/spec/factories/users.rb +0 -23
  113. data/apps/api/spec/models/article_category_spec.rb +0 -7
  114. data/apps/api/spec/models/article_spec.rb +0 -7
  115. data/apps/api/spec/models/user_spec.rb +0 -7
  116. data/apps/api/spec/mutations/base/article_category_spec.rb +0 -46
  117. data/apps/api/spec/mutations/base/article_spec.rb +0 -70
  118. data/apps/api/spec/mutations/base/user_spec.rb +0 -76
  119. data/apps/api/spec/policies/article_category_policy_spec.rb +0 -24
  120. data/apps/api/spec/policies/article_policy_spec.rb +0 -24
  121. data/apps/api/spec/policies/user_policy_spec.rb +0 -24
  122. data/apps/api/spec/queries/article_category_spec.rb +0 -39
  123. data/apps/api/spec/queries/article_spec.rb +0 -53
  124. data/apps/api/spec/queries/user_spec.rb +0 -59
  125. data/apps/api/spec/resolvers/article_category_search_spec.rb +0 -54
  126. data/apps/api/spec/resolvers/article_search_spec.rb +0 -68
  127. data/apps/api/spec/resolvers/user_search_spec.rb +0 -74
  128. data/apps/api/spec/spec_helper.rb +0 -110
  129. data/apps/api/tmp/.keep +0 -0
  130. data/apps/worker/.env.sample +0 -9
  131. data/apps/worker/.gitignore +0 -32
  132. data/apps/worker/.irbrc +0 -4
  133. data/apps/worker/.rspec +0 -3
  134. data/apps/worker/.rubocop.yml +0 -132
  135. data/apps/worker/.ruby-version +0 -1
  136. data/apps/worker/CODE_OF_CONDUCT.md +0 -74
  137. data/apps/worker/Dockerfile +0 -16
  138. data/apps/worker/Dockerfile.dev +0 -17
  139. data/apps/worker/Gemfile +0 -49
  140. data/apps/worker/Gemfile.lock +0 -396
  141. data/apps/worker/LICENSE.txt +0 -67
  142. data/apps/worker/Procfile +0 -1
  143. data/apps/worker/Procfile.dev +0 -1
  144. data/apps/worker/README.md +0 -37
  145. data/apps/worker/Rakefile +0 -5
  146. data/apps/worker/app.rb +0 -101
  147. data/apps/worker/app/engines/notification_engine.rb +0 -5
  148. data/apps/worker/app/graphql/mutations/.keep +0 -0
  149. data/apps/worker/app/graphql/mutations/base_mutation.rb +0 -16
  150. data/apps/worker/app/graphql/mutations/workers/send_user_mail_job.rb +0 -31
  151. data/apps/worker/app/graphql/souls_api_schema.rb +0 -43
  152. data/apps/worker/app/graphql/types/.keep +0 -0
  153. data/apps/worker/app/graphql/types/base/base_argument.rb +0 -4
  154. data/apps/worker/app/graphql/types/base/base_enum.rb +0 -4
  155. data/apps/worker/app/graphql/types/base/base_field.rb +0 -5
  156. data/apps/worker/app/graphql/types/base/base_input_object.rb +0 -5
  157. data/apps/worker/app/graphql/types/base/base_interface.rb +0 -7
  158. data/apps/worker/app/graphql/types/base/base_object.rb +0 -5
  159. data/apps/worker/app/graphql/types/base/base_scalar.rb +0 -4
  160. data/apps/worker/app/graphql/types/base/base_union.rb +0 -4
  161. data/apps/worker/app/graphql/types/base/mutation_type.rb +0 -12
  162. data/apps/worker/app/graphql/types/base/query_type.rb +0 -6
  163. data/apps/worker/app/models/article.rb +0 -4
  164. data/apps/worker/app/models/article_category.rb +0 -3
  165. data/apps/worker/app/models/user.rb +0 -19
  166. data/apps/worker/app/utils/fire_store.rb +0 -9
  167. data/apps/worker/app/utils/souls_helper.rb +0 -96
  168. data/apps/worker/cloudbuild.yml +0 -32
  169. data/apps/worker/config.ru +0 -17
  170. data/apps/worker/config/database.yml +0 -33
  171. data/apps/worker/config/souls.rb +0 -10
  172. data/apps/worker/db/migrate/20200006095538_create_users.rb +0 -30
  173. data/apps/worker/db/migrate/20200712180236_create_article_categories.rb +0 -12
  174. data/apps/worker/db/migrate/20200714215521_create_articles.rb +0 -22
  175. data/apps/worker/db/schema.rb +0 -78
  176. data/apps/worker/db/seeds.rb +0 -44
  177. data/apps/worker/github/workflows/delivery.yml +0 -81
  178. data/apps/worker/log/.keep +0 -0
  179. data/apps/worker/spec/factories/article_categories.rb +0 -9
  180. data/apps/worker/spec/factories/articles.rb +0 -17
  181. data/apps/worker/spec/factories/users.rb +0 -23
  182. data/apps/worker/spec/models/article_category_spec.rb +0 -7
  183. data/apps/worker/spec/models/article_spec.rb +0 -7
  184. data/apps/worker/spec/models/user_spec.rb +0 -7
  185. data/apps/worker/spec/spec_helper.rb +0 -110
  186. data/apps/worker/tmp/.keep +0 -0
  187. data/bin/console +0 -14
  188. data/bin/setup +0 -8
  189. data/config/souls.rb +0 -9
  190. data/db/schema.rb +0 -67
  191. data/rbs/init.rbs +0 -2
  192. data/souls.gemspec +0 -34
@@ -1,43 +0,0 @@
1
- class SoulsApiSchema < GraphQL::Schema
2
- default_max_page_size 100
3
- mutation(Types::MutationType)
4
- query(Types::QueryType)
5
- use GraphQL::Batch
6
-
7
- def self.id_from_object(object, _type_definition, _query_ctx)
8
- # Call your application"s UUID method here
9
- # It should return a string
10
- to_global_id(object.class.name, object.id)
11
- end
12
-
13
- def self.object_from_id(id, _query_ctx)
14
- class_name, item_id = from_global_id(id)
15
-
16
- # "Post" => Post.find(item_id)
17
- Object.const_get(class_name).find(item_id)
18
- end
19
-
20
- def self.resolve_type(_type, obj, _ctx)
21
- case obj
22
- when Article
23
- Types::ArticleType
24
- when User
25
- Types::UserType
26
- when ArticleCategory
27
- Types::ArticleCategoryType
28
- when JobConsole
29
- Types::JobConsoleType
30
- else
31
- GraphQL::ExecutionError.new("Unexpected object: #{obj}")
32
- end
33
- end
34
-
35
- def self.to_global_id(class_name, item_id)
36
- Base64.strict_encode64("#{class_name}:#{item_id}")
37
- end
38
-
39
- def self.from_global_id(global_id)
40
- token = Base64.decode64(global_id)
41
- token.split(":")
42
- end
43
- end
File without changes
@@ -1,12 +0,0 @@
1
- module Types
2
- class ArticleCategoryType < BaseObject
3
- implements GraphQL::Types::Relay::Node
4
-
5
- global_id_field :id
6
- field :created_at, GraphQL::Types::ISO8601DateTime, null: true
7
- field :is_deleted, Boolean, null: true
8
- field :name, String, null: true
9
- field :tags, [String], null: true
10
- field :updated_at, GraphQL::Types::ISO8601DateTime, null: true
11
- end
12
- end
@@ -1,30 +0,0 @@
1
- module Types
2
- class ArticleType < BaseObject
3
- implements GraphQL::Types::Relay::Node
4
-
5
- global_id_field :id
6
- field :article_category, Types::ArticleCategoryType, null: false
7
- field :body, String, null: true
8
- field :created_at, GraphQL::Types::ISO8601DateTime, null: true
9
- field :is_deleted, Boolean, null: true
10
- field :is_public, Boolean, null: true
11
- field :just_created, Boolean, null: true
12
- field :public_date, GraphQL::Types::ISO8601DateTime, null: true
13
- field :slag, String, null: true
14
- field :tags, [String], null: true
15
- field :thumnail_url, String, null: true
16
- field :title, String, null: true
17
- field :updated_at, GraphQL::Types::ISO8601DateTime, null: true
18
- field :user, Types::UserType, null: false
19
-
20
- unless ENV["RACK_ENV"] == "test"
21
- def user
22
- RecordLoader.for(User).load(object.user_id)
23
- end
24
-
25
- def article_category
26
- RecordLoader.for(ArticleCategory).load(object.article_category_id)
27
- end
28
- end
29
- end
30
- end
@@ -1,4 +0,0 @@
1
- module Types
2
- class BaseArgument < GraphQL::Schema::Argument
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module Types
2
- class BaseEnum < GraphQL::Schema::Enum
3
- end
4
- end
@@ -1,5 +0,0 @@
1
- module Types
2
- class BaseField < GraphQL::Schema::Field
3
- argument_class Types::BaseArgument
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- module Types
2
- class BaseInputObject < GraphQL::Schema::InputObject
3
- argument_class Types::BaseArgument
4
- end
5
- end
@@ -1,7 +0,0 @@
1
- module Types
2
- module BaseInterface
3
- include GraphQL::Schema::Interface
4
-
5
- field_class Types::BaseField
6
- end
7
- end
@@ -1,6 +0,0 @@
1
- module Types
2
- class BaseObject < GraphQL::Schema::Object
3
- field_class Types::BaseField
4
- connection_type_class Types::BaseConnection
5
- end
6
- end
@@ -1,4 +0,0 @@
1
- module Types
2
- class BaseScalar < GraphQL::Schema::Scalar
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module Types
2
- class BaseUnion < GraphQL::Schema::Union
3
- end
4
- end
@@ -1,26 +0,0 @@
1
- module Types
2
- class MutationType < Types::BaseObject
3
- SoulsHelper.get_tables.each do |t|
4
- %w[create update delete destroy_delete].each do |a|
5
- field "#{a}_#{t.singularize.underscore}".to_sym,
6
- mutation: Object.const_get(
7
- "Mutations::Base::#{t.singularize.camelize}::#{a.camelize}#{t.singularize.camelize}"
8
- )
9
- end
10
- end
11
-
12
- managers =
13
- Dir["./app/graphql/mutations/managers/*_manager/*.rb"].map do |file|
14
- {
15
- class: file.match(%r{managers/(.+?)_manager})[1],
16
- name: file.match(%r{/([^/]+)/?$})[1].gsub(".rb", "")
17
- }
18
- end
19
- managers.each do |file|
20
- field file[:name].underscore.to_s.to_sym,
21
- mutation: Object.const_get(
22
- "Mutations::Managers::#{file[:class].singularize.camelize}Manager::#{file[:name].singularize.camelize}"
23
- )
24
- end
25
- end
26
- end
@@ -1,18 +0,0 @@
1
- module Types
2
- class QueryType < Types::BaseObject
3
- add_field(GraphQL::Types::Relay::NodeField)
4
- add_field(GraphQL::Types::Relay::NodesField)
5
- SoulsHelper.get_tables.each do |t|
6
- field t.singularize.underscore.to_s.to_sym, resolver: Object.const_get("Queries::#{t.singularize.camelize}")
7
- field "#{t.singularize.underscore}_search".to_sym,
8
- resolver: Object.const_get("Resolvers::#{t.singularize.camelize}Search")
9
- field t.pluralize.underscore.to_s.to_sym,
10
- Object.const_get("Types::#{t.singularize.camelize}Type").connection_type,
11
- null: true
12
- define_method t do
13
- Object.const_get(t.singularize.camelize.to_s).all.order(id: :desc)
14
- end
15
- end
16
- field :me, resolver: Queries::Me
17
- end
18
- end
@@ -1,3 +0,0 @@
1
- class Types::ArticleCategoryConnection < Types::BaseConnection
2
- edge_type(Types::ArticleCategoryEdge)
3
- end
@@ -1,3 +0,0 @@
1
- class Types::ArticleConnection < Types::BaseConnection
2
- edge_type(Types::ArticleEdge)
3
- end
@@ -1,14 +0,0 @@
1
- module Types
2
- class BaseConnection < GraphQL::Types::Relay::BaseConnection
3
- field :total_count, Integer, null: false
4
- field :total_pages, Integer, null: false
5
-
6
- def total_count
7
- object.items.size
8
- end
9
-
10
- def total_pages
11
- total_count / object.max_page_size + 1
12
- end
13
- end
14
- end
@@ -1,3 +0,0 @@
1
- class Types::UserConnection < Types::BaseConnection
2
- edge_type(Types::UserEdge)
3
- end
@@ -1,5 +0,0 @@
1
- module Types
2
- class ArticleCategoryEdge < Types::BaseEdge
3
- node_type(Types::ArticleCategoryType)
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- module Types
2
- class ArticleEdge < Types::BaseEdge
3
- node_type(Types::ArticleType)
4
- end
5
- end
@@ -1,4 +0,0 @@
1
- module Types
2
- class BaseEdge < GraphQL::Types::Relay::BaseEdge
3
- end
4
- end
@@ -1,5 +0,0 @@
1
- module Types
2
- class UserEdge < Types::BaseEdge
3
- node_type(Types::UserType)
4
- end
5
- end
@@ -1,24 +0,0 @@
1
- module Types
2
- class UserType < BaseObject
3
- implements GraphQL::Types::Relay::Node
4
-
5
- global_id_field :id
6
- field :birthday, String, null: true
7
- field :created_at, GraphQL::Types::ISO8601DateTime, null: true
8
- field :email, String, null: true
9
- field :first_name, String, null: true
10
- field :first_name_kana, String, null: true
11
- field :first_name_kanji, String, null: true
12
- field :icon_url, String, null: true
13
- field :last_name, String, null: true
14
- field :last_name_kana, String, null: true
15
- field :last_name_kanji, String, null: true
16
- field :roles, String, null: true
17
- field :roles_mask, Integer, null: true
18
- field :screen_name, String, null: true
19
- field :tel, String, null: true
20
- field :uid, String, null: true
21
- field :updated_at, GraphQL::Types::ISO8601DateTime, null: true
22
- field :username, String, null: true
23
- end
24
- end
@@ -1,4 +0,0 @@
1
- class Article < ActiveRecord::Base
2
- belongs_to :user
3
- belongs_to :article_category
4
- end
@@ -1,3 +0,0 @@
1
- class ArticleCategory < ActiveRecord::Base
2
- has_many :article, dependent: :destroy
3
- end
@@ -1,19 +0,0 @@
1
- class User < ActiveRecord::Base
2
- include RoleModel
3
- has_many :article
4
-
5
- VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
6
- private_constant :VALID_EMAIL_REGEX
7
- validates :email, presence: true, uniqueness: true, format: { with: VALID_EMAIL_REGEX }
8
-
9
- roles :normal, :user, :admin, :master
10
-
11
- before_create :assign_initial_roles
12
-
13
- # Scope
14
- default_scope -> { order(created_at: :desc) }
15
-
16
- def assign_initial_roles
17
- roles << [:normal]
18
- end
19
- end
@@ -1,40 +0,0 @@
1
- class ApplicationPolicy
2
- attr_reader :user, :record
3
-
4
- def initialize(user, record)
5
- @user = user
6
- @record = record
7
- end
8
-
9
- def index?
10
- true
11
- end
12
-
13
- def show?
14
- scope.where(id: record.id).exists?
15
- end
16
-
17
- def create?
18
- true
19
- end
20
-
21
- def new?
22
- true
23
- end
24
-
25
- def update?
26
- true
27
- end
28
-
29
- def edit?
30
- true
31
- end
32
-
33
- def destroy?
34
- @user.master?
35
- end
36
-
37
- def scope
38
- Pundit.policy_scope!(user, record.class)
39
- end
40
- end
@@ -1,31 +0,0 @@
1
- class ArticleCategoryPolicy < ApplicationPolicy
2
- def show?
3
- true
4
- end
5
-
6
- def index?
7
- true
8
- end
9
-
10
- def create?
11
- user_permissions?
12
- end
13
-
14
- def update?
15
- user_permissions?
16
- end
17
-
18
- def delete?
19
- admin_permissions?
20
- end
21
-
22
- private
23
-
24
- def user_permissions?
25
- @user.master? or @user.admin? or @user.user?
26
- end
27
-
28
- def admin_permissions?
29
- @user.master? or @user.admin?
30
- end
31
- end
@@ -1,31 +0,0 @@
1
- class ArticlePolicy < ApplicationPolicy
2
- def show?
3
- true
4
- end
5
-
6
- def index?
7
- true
8
- end
9
-
10
- def create?
11
- user_permissions?
12
- end
13
-
14
- def update?
15
- user_permissions?
16
- end
17
-
18
- def delete?
19
- admin_permissions?
20
- end
21
-
22
- private
23
-
24
- def user_permissions?
25
- @user.master? or @user.admin? or @user.user?
26
- end
27
-
28
- def admin_permissions?
29
- @user.master? or @user.admin?
30
- end
31
- end
@@ -1,35 +0,0 @@
1
- class UserPolicy < ApplicationPolicy
2
- def show?
3
- true
4
- end
5
-
6
- def index?
7
- true
8
- end
9
-
10
- def create?
11
- user_permissions?
12
- end
13
-
14
- def update?
15
- user_permissions?
16
- end
17
-
18
- def delete?
19
- admin_permissions?
20
- end
21
-
22
- def update_user_role?
23
- @user.master?
24
- end
25
-
26
- private
27
-
28
- def user_permissions?
29
- @user.user? or @user.admin? or @user.master?
30
- end
31
-
32
- def admin_permissions?
33
- @user.master? or @user.admin?
34
- end
35
- end