Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vernemq
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
stack
vernemq
Commits
14c11a3b
Commit
14c11a3b
authored
Sep 16, 2018
by
zCaesar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add utils are getGroupID and getTopic
parent
f644cd7a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
0 deletions
+51
-0
authhook/utils/getGroupID.js
+31
-0
authhook/utils/getTopic.js
+20
-0
No files found.
authhook/utils/getGroupID.js
0 → 100644
View file @
14c11a3b
var
getRole
=
require
(
'../checkClientRole'
).
getRole
function
getGroupID
(
token
,
id
,
cb
)
{
checkID
(
token
,
id
,
(
groupId
)
=>
{
// console.log(groupId)
cb
(
groupId
)
})
}
module
.
exports
.
getGroupID
=
getGroupID
function
checkID
(
token
,
id
,
cb
)
{
// console.log(token)
getRole
(
token
,
(
role
)
=>
{
// console.log(role)
if
(
role
.
hasOwnProperty
(
'groupId'
))
{
cb
(
role
.
info
.
groupId
)
}
else
{
doDB
(
id
,
(
groupId
)
=>
{
// console.log(groupId)
cb
(
groupId
)
})
}
})
}
function
doDB
(
id
,
cb
)
{
var
groupId
=
'test'
cb
(
groupId
)
}
\ No newline at end of file
authhook/utils/getTopic.js
0 → 100644
View file @
14c11a3b
function
getTopic
(
topic
,
id
)
{
var
_topic
=
classifiedTopic
(
topic
)
+
'/!'
+
id
+
topic
.
split
(
classifiedTopic
(
topic
))[
1
]
return
_topic
}
module
.
exports
.
getTopic
=
getTopic
function
classifiedTopic
(
topic
)
{
if
(
topic
.
indexOf
(
'@msg'
)
!==
-
1
)
{
return
'@msg'
}
else
if
(
topic
.
indexOf
(
'@shadow/updated'
)
!==
-
1
)
{
return
'@shadow/updated'
}
else
if
(
topic
.
indexOf
(
'@shadow/update'
)
!==
-
1
)
{
return
'@shadow/update'
}
else
if
(
topic
.
indexOf
(
'@shadow/get'
)
!==
-
1
)
{
return
'@shadow/get'
}
else
if
(
topic
.
indexOf
(
'@client'
)
!==
-
1
)
{
return
'@client'
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment