Skip to content

Commit 4641dd4

Browse files
authored
Merge pull request #281 from developmentseed/fix/permissions-fixes
Permission fixes
2 parents 5bbded2 + a6ffc3c commit 4641dd4

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

app/manage/permissions/view-team-members.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
const { isPublic, isMember } = require('../../lib/team')
1+
const { isPublic, isMember, associatedOrg } = require('../../lib/team')
2+
const { isOwner } = require('../../lib/organization')
23

34
/**
45
* team:view-members
@@ -15,7 +16,11 @@ async function viewTeamMembers (uid, { id }) {
1516
if (publicTeam) return publicTeam
1617

1718
try {
18-
return await isMember(id, uid)
19+
const org = await associatedOrg(id)
20+
const ownerOfTeam = org && (await isOwner(org.organization_id, uid))
21+
22+
// You can view the members if you're part of the team, or in case of an org team if you're the owner
23+
return ownerOfTeam || await isMember(id, uid)
1924
} catch (e) {
2025
return false
2126
}

pages/invitation.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ export default class Invitation extends Component {
8585
}
8686

8787
if (!team) return null
88+
const userId = this.props.user.uid
89+
if (!userId) {
90+
return <article className='inner page'>
91+
You are not logged in. Sign in and come back to this link.
92+
</article>
93+
}
8894
return (
8995
<article className='inner page'>
9096
You have been invited to join <b>{team.name}</b>

pages/login.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Login extends Component {
1616
const OSM_NAME = publicRuntimeConfig.OSM_NAME
1717
return (
1818
<section className='inner page'>
19-
<h1>Login Provider</h1>
19+
<h1>Login</h1>
2020
<p>Teams uses {OSM_NAME} as your login, connect your {OSM_NAME} account!</p>
2121
<br />
2222
<Button href={`/oauth/openstreetmap?login_challenge=${this.props.challenge}`}>Login with {OSM_NAME}</Button>

0 commit comments

Comments
 (0)