Skip to content

Commit

Permalink
Create a new server method userIsAdmin
Browse files Browse the repository at this point in the history
The method checkes if current user has an admin role
  • Loading branch information
marla-singer committed Apr 13, 2017
1 parent a982d14 commit 53e85d5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions users/server/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ import { check } from 'meteor/check';

// Meteor contributed packages imports
import { Accounts } from 'meteor/accounts-base';
import { Roles } from 'meteor/alanning:roles';
import { ValidEmail } from 'meteor/froatsnook:valid-email';

// Collection imports
import Settings from '/settings/collection';

Meteor.methods({
userIsAdmin () {
// Make sure user is admin
return Roles.userIsInRole(this.userId, ['admin']);
},
deleteAccount (userId) {
// Make sure userId is a String
check(userId, String);
Expand Down

0 comments on commit 53e85d5

Please sign in to comment.