 
   rightsStringToRightsObject currentUser.rights
 
+module.exports.tryCoerceNumber = (
+) ->
+  (value) ->
+    unless 'string' is typeof value
+      return value
+    maybeNumber = parseInt value, 10
+    if isNaN maybeNumber
+      return value
+    if maybeNumber.toString() isnt value
+      return value
+    return maybeNumber
+
 module.exports.currentUserHasRight = (
   currentRightsObject
   isjs
+  tryCoerceNumber
   _
 ) ->
   (right, args...) ->
-    filteredArgs = _.filter args, isjs.not.undefined
-    result = if filteredArgs.length is 0
-      currentRightsObject[right]? or currentRightsObject[right + '()']?
-    else
-      currentRightsObject[right + '(' + filteredArgs.join(',') + ')']?
-    return result
+    # filteredArgs = _.filter args, isjs.not.undefined
+
+    args = args.map tryCoerceNumber
+    rightArgsArray = currentRightsObject[right]
+    # console.log 'currentUserHasRight',
+    #   right: right
+    #   args: args
+    #   currentRightsObject: currentRightsObject
+    #   rightArgsArray: rightArgsArray
+    unless rightArgsArray?
+      return false
+    _.some rightArgsArray, (rightArgs) ->
+      # console.log 'equal',
+      #   right: right
+      #   args: args
+      #   rightArgs: rightArgs
+      #   equal: _.isEqual args, rightArgs
+      _.isEqual args, rightArgs
+
+module.exports.currentUserRightArgs = (
+  currentRightsObject
+) ->
+  (right) ->
+    currentRightsObject[right]

    unless user?
      return null
    _.omit user, 'password'

module.exports.currentRightsArray = (
  currentUser

module.exports.currentUser = (
  token
  firstUserWhereId
