Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@orbiting/backend-modules-auth

Package Overview
Dependencies
Maintainers
6
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@orbiting/backend-modules-auth - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

21

CHANGELOG.md

@@ -1,6 +0,23 @@

<a name="2.0.0"></a>
# 2.0.0 (2017-12-20)
<a name="2.1.0"></a>
# 2.1.0 (2017-12-21)
<a name="2.1.0"></a>
# 2.1.0 (2017-12-21)
### Bug Fixes
* **backend-modules-auth:** fix and or logic ([55e316e](https://github.com/orbiting/backend-modules/commit/55e316e))
* **backend-modules-auth:** only allow editors to access user.email ([ea04821](https://github.com/orbiting/backend-modules/commit/ea04821))
### Features
* **backend-modules-auth:** allow admins and supporters to access get user details ([6dd1017](https://github.com/orbiting/backend-modules/commit/6dd1017))
* **backend-modules-auth:** expose user createdAt and updatedAt ([f5d3608](https://github.com/orbiting/backend-modules/commit/f5d3608))
<a name="2.0.0"></a>

@@ -7,0 +24,0 @@ # 2.0.0 (2017-12-20)

9

graphql/resolvers/_queries/user.js

@@ -16,9 +16,8 @@ const transformUser = require('../../../lib/transformUser')

if (
!user ||
(!user.hasPublicProfile && !Roles.userIsMe(user, me))
user &&
(user.hasPublicProfile || Roles.userIsMeOrInRoles(user, me, ['admin', 'supporter']))
) {
return null
return transformUser(user)
}
return transformUser(user)
return null
}
const Roles = require('../../lib/Roles')
const userAccessRoles = ['admin', 'supporter']
module.exports = {
email (user, args, { pgdb, user: me }) {
if (Roles.userIsMeOrInRoles(user, me, ['admin', 'supporter', 'accountant', 'editor'])) {
if (Roles.userIsMeOrInRoles(user, me, [...userAccessRoles, 'editor'])) {
return user.email

@@ -23,3 +24,11 @@ }

return []
},
createdAt (user, args, { user: me }) {
Roles.ensureUserIsMeOrInRoles(user, me, userAccessRoles)
return user._raw.createdAt
},
updatedAt (user, args, { user: me }) {
Roles.ensureUserIsMeOrInRoles(user, me, userAccessRoles)
return user._raw.updatedAt
}
}

@@ -12,2 +12,4 @@ module.exports = `

roles: [String!]!
createdAt: DateTime!
updatedAt: DateTime!
}

@@ -14,0 +16,0 @@

@@ -90,2 +90,7 @@ const t = require('./t')

const ensureUserIsMeOrInRoles = (user, me, roles) => (
userIsMe(user, me) ||
ensureUserIsInRoles(me, roles)
)
const userIsMeOrHasProfile = (user, me) => (

@@ -103,2 +108,3 @@ user._raw.hasPublicProfile ||

userIsMeOrInRoles,
ensureUserIsMeOrInRoles,
userIsMeOrHasProfile,

@@ -105,0 +111,0 @@ ensureUserIsInRoles,

{
"name": "@orbiting/backend-modules-auth",
"version": "2.0.0",
"version": "2.1.0",
"description": "auth migrations, seeds, middleware, graphql schema and resolvers",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc