Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
MKCLOS
Core Development Platform
corepkgv2
Commits
976cf802
Commit
976cf802
authored
4 years ago
by
Kunal Taitkar
2
Browse files
Options
Downloads
Patches
Plain Diff
Pre/Post hook changes
parent
f51c37e5
Branches
Branches containing commit
Tags
MEP19.03.2020
Tags containing commit
3 merge requests
!220
Release v2.0.0 alpha
,
!219
Add: Support for branches
,
!216
Pre/Post hook changes
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
routebuildermdl/routebuildermdl.go
+10
-8
routebuildermdl/routebuildermdl.go
routebuildermdl/serviceCachemdl.go
+1
-0
routebuildermdl/serviceCachemdl.go
with
11 additions
and
8 deletions
routebuildermdl/routebuildermdl.go
+
10
−
8
View file @
976cf802
...
@@ -145,18 +145,19 @@ func validateRoleFromToken(principalObj servicebuildermdl.Principal, service Ser
...
@@ -145,18 +145,19 @@ func validateRoleFromToken(principalObj servicebuildermdl.Principal, service Ser
func
(
s
ServiceCache
)
preHooksExec
(
rs
*
gjson
.
Result
,
principalObj
*
servicebuildermdl
.
Principal
)
{
func
(
s
ServiceCache
)
preHooksExec
(
rs
*
gjson
.
Result
,
principalObj
*
servicebuildermdl
.
Principal
)
{
for
i
:=
0
;
i
<
len
(
s
.
PreHooks
);
i
++
{
for
i
:=
0
;
i
<
len
(
s
.
PreHooks
);
i
++
{
var
service
interface
{}
var
service
interface
{}
activityName
:=
ConcatenateEntityWithBranch
(
s
.
PreHooks
[
i
]
.
ActivityName
,
s
.
PreHooks
[
i
]
.
Branch
)
var
found
bool
var
found
bool
if
s
.
PreHooks
[
i
]
.
ActorType
==
"ROLEBASED"
{
if
s
.
PreHooks
[
i
]
.
ActorType
==
"ROLEBASED"
{
service
,
found
=
roleBasedServices
.
Get
(
s
.
PreHooks
[
i
]
.
A
ctivityName
)
service
,
found
=
roleBasedServices
.
Get
(
a
ctivityName
)
}
}
if
s
.
PreHooks
[
i
]
.
ActorType
==
"RESTRICTED"
{
if
s
.
PreHooks
[
i
]
.
ActorType
==
"RESTRICTED"
{
service
,
found
=
restrictedServices
.
Get
(
s
.
PreHooks
[
i
]
.
A
ctivityName
)
service
,
found
=
restrictedServices
.
Get
(
a
ctivityName
)
}
}
if
s
.
PreHooks
[
i
]
.
ActorType
==
"OPEN"
{
if
s
.
PreHooks
[
i
]
.
ActorType
==
"OPEN"
{
service
,
found
=
openServices
.
Get
(
s
.
PreHooks
[
i
]
.
A
ctivityName
)
service
,
found
=
openServices
.
Get
(
a
ctivityName
)
}
}
if
!
found
{
if
!
found
{
loggermdl
.
LogError
(
"Pre Hook Not found: "
,
s
.
PreHooks
[
i
]
.
A
ctivityName
,
" for actor type: "
,
s
.
PreHooks
[
i
]
.
ActorType
)
loggermdl
.
LogError
(
"Pre Hook Not found: "
,
a
ctivityName
,
" for actor type: "
,
s
.
PreHooks
[
i
]
.
ActorType
,
" branch:"
,
s
.
PreHooks
[
i
]
.
Branch
)
return
return
}
}
tmpServiceCache
:=
service
.
(
ServiceCache
)
tmpServiceCache
:=
service
.
(
ServiceCache
)
...
@@ -179,19 +180,20 @@ func (s ServiceCache) postHooksExec(data interface{}, principalObj *servicebuild
...
@@ -179,19 +180,20 @@ func (s ServiceCache) postHooksExec(data interface{}, principalObj *servicebuild
}
}
}
}
for
i
:=
0
;
i
<
len
(
s
.
PostHooks
);
i
++
{
for
i
:=
0
;
i
<
len
(
s
.
PostHooks
);
i
++
{
activityName
:=
ConcatenateEntityWithBranch
(
s
.
PostHooks
[
i
]
.
ActivityName
,
s
.
PostHooks
[
i
]
.
Branch
)
var
service
interface
{}
var
service
interface
{}
var
found
bool
var
found
bool
if
s
.
PostHooks
[
i
]
.
ActorType
==
"ROLEBASED"
{
if
s
.
PostHooks
[
i
]
.
ActorType
==
"ROLEBASED"
{
service
,
found
=
roleBasedServices
.
Get
(
s
.
PostHooks
[
i
]
.
A
ctivityName
)
service
,
found
=
roleBasedServices
.
Get
(
a
ctivityName
)
}
}
if
s
.
PostHooks
[
i
]
.
ActorType
==
"RESTRICTED"
{
if
s
.
PostHooks
[
i
]
.
ActorType
==
"RESTRICTED"
{
service
,
found
=
restrictedServices
.
Get
(
s
.
PostHooks
[
i
]
.
A
ctivityName
)
service
,
found
=
restrictedServices
.
Get
(
a
ctivityName
)
}
}
if
s
.
PostHooks
[
i
]
.
ActorType
==
"OPEN"
{
if
s
.
PostHooks
[
i
]
.
ActorType
==
"OPEN"
{
service
,
found
=
openServices
.
Get
(
s
.
PostHooks
[
i
]
.
A
ctivityName
)
service
,
found
=
openServices
.
Get
(
a
ctivityName
)
}
}
if
!
found
{
if
!
found
{
loggermdl
.
LogError
(
"Post Hook Not found: "
,
s
.
PostHooks
[
i
]
.
A
ctivityName
,
" for actor type: "
,
s
.
PostHooks
[
i
]
.
ActorType
)
loggermdl
.
LogError
(
"Post Hook Not found: "
,
a
ctivityName
,
" for actor type: "
,
s
.
PostHooks
[
i
]
.
ActorType
,
" Branch:"
,
s
.
PostHooks
[
i
]
.
Branch
)
return
return
}
}
tmpServiceCache
:=
service
.
(
ServiceCache
)
tmpServiceCache
:=
service
.
(
ServiceCache
)
...
...
This diff is collapsed.
Click to expand it.
routebuildermdl/serviceCachemdl.go
+
1
−
0
View file @
976cf802
...
@@ -35,6 +35,7 @@ func init() {
...
@@ -35,6 +35,7 @@ func init() {
type
Hook
struct
{
type
Hook
struct
{
ActivityName
string
ActivityName
string
ActorType
string
ActorType
string
Branch
string
}
}
// ServiceCache ServiceCache object
// ServiceCache ServiceCache object
...
...
This diff is collapsed.
Click to expand it.
Ajit Jagtap
@ajitj
mentioned in commit
45b93576
·
4 years ago
mentioned in commit
45b93576
mentioned in commit 45b93576613fffa28ac13e87fd0c8f3486586208
Toggle commit list
Akshay Bharambe
@akshayb
mentioned in merge request
!226 (merged)
·
4 years ago
mentioned in merge request
!226 (merged)
mentioned in merge request !226
Toggle commit list
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets