Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Commit

Permalink
cnodejs github users are admins
Browse files Browse the repository at this point in the history
  • Loading branch information
thoward committed Aug 3, 2012
1 parent 2565824 commit f38f4e5
Show file tree
Hide file tree
Showing 38 changed files with 14,331 additions and 8 deletions.
27 changes: 22 additions & 5 deletions app.js
Expand Up @@ -76,11 +76,28 @@ var authRequired = function (req, res, next) {

var adminRequired = function (req, res, next) {
var user = req.session.oauthUser;
if (config.admins.indexOf(user.t_url) !== -1) {
next();
} else {
res.send(401, {'status': 'fail', 'message': 'unauthorized'});
}

var GitHubApi = require("github");

var github = new GitHubApi({
version: "3.0.0"
});

var admins = [];

github.orgs.getMembers({org: "cnodejs"},
function(err, members) {
for (i in members) {
var member_url = (members[i].url || '').replace('api.github.com/users', 'github.com');
admins.push(member_url);
}

if (admins.concat(config.admins).indexOf(user.t_url) !== -1) {
next();
} else {
res.send(401, {'status': 'fail', 'message': u.t_url + ' is unauthorized'});
}
});
};

app.get('/survey', survey.inviteTopics);
Expand Down
3 changes: 3 additions & 0 deletions node_modules/github/.npmignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions node_modules/github/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

128 changes: 128 additions & 0 deletions node_modules/github/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions node_modules/github/api/v2.0.0/routes.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f38f4e5

Please sign in to comment.