cats_core 1.1.18 → 1.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/cats/core/roles_controller.rb +6 -0
- data/app/controllers/cats/core/users_controller.rb +28 -2
- data/app/serializers/cats/core/role_serializer.rb +3 -0
- data/app/serializers/cats/core/user_serializer.rb +3 -0
- data/config/routes.rb +6 -0
- data/lib/cats/core/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ac17edba232672ae0f11dc2042dbb8c58f7a3bbe6f5f032e3407a23292b1db8
|
4
|
+
data.tar.gz: d35a4ea6ab6e34d1a3ea13b784056916a22dc60d9da2ab9e015d34863dd7173d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c46e405c2735c8a73c814c71429c2bfeebf2a39f8130aa574e750f996006722fed3bc7a90508fab437359c9530f50578060b3c619b5cc2a029f617515df92529
|
7
|
+
data.tar.gz: c53c84bc2f39768f72eaeab44bcee50e70d621028a72bace55aa263a618b4eaf69249ca5969defad1060bbe5428bb1d60ae15926de4028eabed76a4b7a7d8ad8
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Cats
|
2
2
|
module Core
|
3
3
|
class RolesController < ApplicationController
|
4
|
+
include Common
|
5
|
+
|
4
6
|
before_action :set_role, only: [:users]
|
5
7
|
|
6
8
|
def users
|
@@ -13,6 +15,10 @@ module Cats
|
|
13
15
|
def set_role
|
14
16
|
@role = Role.find_by(name: params[:name])
|
15
17
|
end
|
18
|
+
|
19
|
+
def model_params
|
20
|
+
params.require(:payload).permit(:name, :application_module_id)
|
21
|
+
end
|
16
22
|
end
|
17
23
|
end
|
18
24
|
end
|
@@ -1,7 +1,26 @@
|
|
1
1
|
module Cats
|
2
2
|
module Core
|
3
3
|
class UsersController < ApplicationController
|
4
|
-
|
4
|
+
include Common
|
5
|
+
|
6
|
+
before_action :set_user, only: %i[roles assign_role stores warehouse hub]
|
7
|
+
|
8
|
+
def index
|
9
|
+
users = Cats::Core::User.where(application_module_id: params[:id])
|
10
|
+
render json: { success: true, data: serialize(users) }
|
11
|
+
end
|
12
|
+
|
13
|
+
def roles
|
14
|
+
data = ActiveModelSerializers::SerializableResource.new(@user.roles)
|
15
|
+
render json: { success: true, data: data }
|
16
|
+
end
|
17
|
+
|
18
|
+
def assign_role
|
19
|
+
role = Cats::Core::Role.find(params[:role_id])
|
20
|
+
@user.roles << role
|
21
|
+
data = ActiveModelSerializers::SerializableResource.new(@user)
|
22
|
+
render json: { success: true, data: data }
|
23
|
+
end
|
5
24
|
|
6
25
|
def stores
|
7
26
|
data = ActiveModelSerializers::SerializableResource.new(@user.stores)
|
@@ -21,7 +40,14 @@ module Cats
|
|
21
40
|
private
|
22
41
|
|
23
42
|
def set_user
|
24
|
-
@user = User.find(params[:id])
|
43
|
+
@user = Cats::Core::User.find(params[:id])
|
44
|
+
end
|
45
|
+
|
46
|
+
def model_params
|
47
|
+
params.require(:payload).permit(
|
48
|
+
:first_name, :last_name, :email, :phone_number, :active, :password, :password_confirmation, :details,
|
49
|
+
:application_module_id
|
50
|
+
)
|
25
51
|
end
|
26
52
|
end
|
27
53
|
end
|
data/config/routes.rb
CHANGED
@@ -5,6 +5,8 @@ Cats::Core::Engine.routes.draw do
|
|
5
5
|
get '/notifications/unread', controller: :notifications, action: :unread
|
6
6
|
get '/notifications/read', controller: :notifications, action: :read
|
7
7
|
|
8
|
+
get '/application_modules/:id/users', controller: :users, action: :index, as: :application_users
|
9
|
+
|
8
10
|
resources :menus, only: [:index]
|
9
11
|
resources :notifications, only: [:index] do
|
10
12
|
member do
|
@@ -12,6 +14,8 @@ Cats::Core::Engine.routes.draw do
|
|
12
14
|
post 'mark_as_unread', controller: :notifications, action: :mark_as_unread
|
13
15
|
end
|
14
16
|
end
|
17
|
+
|
18
|
+
get '/roles/:id/', controller: :roles, action: :show
|
15
19
|
resources :roles, param: :name do
|
16
20
|
member do
|
17
21
|
get 'users', controller: :roles, action: :users
|
@@ -19,9 +23,11 @@ Cats::Core::Engine.routes.draw do
|
|
19
23
|
end
|
20
24
|
resources :users do
|
21
25
|
member do
|
26
|
+
get 'roles'
|
22
27
|
get 'stores', controller: :users, action: :stores
|
23
28
|
get 'warehouse', controller: :users, action: :warehouse
|
24
29
|
get 'hub', controller: :users, action: :hub
|
30
|
+
post 'assign_role'
|
25
31
|
end
|
26
32
|
end
|
27
33
|
|
data/lib/cats/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cats_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henock L.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-10-
|
11
|
+
date: 2021-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|
@@ -297,7 +297,9 @@ files:
|
|
297
297
|
- app/serializers/cats/core/receipt_serializer.rb
|
298
298
|
- app/serializers/cats/core/receipt_transaction_serializer.rb
|
299
299
|
- app/serializers/cats/core/role_menu_serializer.rb
|
300
|
+
- app/serializers/cats/core/role_serializer.rb
|
300
301
|
- app/serializers/cats/core/unit_of_measure_serializer.rb
|
302
|
+
- app/serializers/cats/core/user_serializer.rb
|
301
303
|
- app/services/cats/core/dispatch_service.rb
|
302
304
|
- app/services/cats/core/menu_service.rb
|
303
305
|
- app/services/cats/core/notification_service.rb
|