Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
N
node-bigstream
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bs
node-bigstream
Commits
f2ba49cd
Commit
f2ba49cd
authored
May 23, 2017
by
project
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
a9ab72aa
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
18 deletions
+42
-18
cronlist.js
lib/mems/cronlist.js
+7
-6
http-acl.js
lib/mems/http-acl.js
+35
-12
No files found.
lib/mems/cronlist.js
View file @
f2ba49cd
...
...
@@ -56,12 +56,6 @@ CronList.prototype.clean = function()
CronList
.
prototype
.
update
=
function
(
cb
)
{
var
self
=
this
;
// this.mem.get(PREFIX, function (err, result) {
// if(!err && result){
// self.list = JSON.parse(result);
// }
// cb(err);
// });
self
.
list
=
[];
self
.
mem
.
hgetall
(
KEYS
,
function
(
err
,
res
){
if
(
!
err
&&
res
){
...
...
@@ -81,6 +75,13 @@ CronList.prototype.update = function(cb)
cb
(
err
);
});
// this.mem.get(PREFIX, function (err, result) {
// if(!err && result){
// self.list = JSON.parse(result);
// }
// cb(err);
// });
}
CronList
.
prototype
.
commit
=
function
(
cb
)
...
...
lib/mems/http-acl.js
View file @
f2ba49cd
var
Redis
=
require
(
'redis'
);
const
PREFIX
=
'bs:http:acl'
;
const
KEYS
=
'bs:regis:triggers'
;
module
.
exports
.
create
=
function
(
cfg
)
{
return
new
HttpACL
(
cfg
);
}
module
.
exports
.
mkACL
=
function
(
appkey
,
method
,
jobid
,
opt
)
module
.
exports
.
mkACL
=
mkACL
;
function
mkACL
(
appkey
,
method
,
jobid
,
opt
)
{
var
a
=
{
'appkey'
:
appkey
,
...
...
@@ -54,25 +56,46 @@ HttpACL.prototype.clean = function()
HttpACL
.
prototype
.
update
=
function
(
cb
)
{
var
self
=
this
;
this
.
mem
.
get
(
PREFIX
,
function
(
err
,
result
)
{
if
(
!
err
&&
result
){
self
.
clean
()
self
.
mem
.
hgetall
(
KEYS
,
function
(
err
,
res
){
if
(
!
err
&&
res
){
self
.
acl
=
JSON
.
parse
(
result
);
var
ks
=
Object
.
keys
(
res
);
for
(
var
i
=
0
;
i
<
ks
.
length
;
i
++
)
{
var
k
=
ks
[
i
];
var
trigger
=
JSON
.
parse
(
res
[
k
]);
if
(
trigger
.
type
==
'http'
)
{
var
acl
=
mkACL
(
trigger
.
appkey
,
trigger
.
method
,
trigger
.
job_id
);
self
.
add
(
acl
);
}
}
}
cb
(
err
);
});
}
HttpACL
.
prototype
.
commit
=
function
(
cb
)
{
var
stracl
=
JSON
.
stringify
(
this
.
acl
);
this
.
mem
.
set
(
PREFIX
,
stracl
);
if
(
typeof
cb
==
'function'
){
cb
();
}
// this.mem.get(PREFIX, function (err, result) {
// if(!err && result){
//
// self.acl = JSON.parse(result);
// }
// cb(err);
// });
}
// HttpACL.prototype.commit = function(cb)
// {
// var stracl = JSON.stringify(this.acl);
// this.mem.set(PREFIX,stracl);
//
// if(typeof cb == 'function'){
// cb();
// }
// }
HttpACL
.
prototype
.
findJob
=
function
(
appkey
,
method
)
{
var
jobs
=
[];
...
...
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