Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: set teams that automatically grant permissions #504

Merged
merged 19 commits into from
Sep 30, 2020

Conversation

bobheadxi
Copy link
Member

@bobheadxi bobheadxi commented Sep 28, 2020

Pull Request

Description

Give a brief description of your changes:

Adds ability for all members in certain teams to get Rocket permissions. Need this to automatically grant everyone in @ubclaunchpad/leads the ability to create teams.

We'll need to add the following to our config:

GITHUB_ADMIN_TEAM_NAME='exec'
GITHUB_LEADS_TEAM_NAME='leads'

I know we talked about possibly dropping refresh (#490), but we still need a way to perform the initial sync - I imagine refresh might stay around purely for use cases like this.

There is also a workaround for #497 that I think should work in 35e1209

Testing

If testing this change requires extra setup, please document it here:

Ticket(s)

Closes #496

(Create a copy of that line for each Github Issue affected,
and replace "Affects" with "Closes" if merging this will close the relevant ticket.)

@bobheadxi bobheadxi requested review from a team as code owners September 28, 2020 07:24
@bobheadxi bobheadxi changed the title Permission teams feat: set teams that automatically grant permissions Sep 28, 2020
We sort teams such that special-permissions teams are sync'd last, so that inherited permissions are not overwritten in child folders. This is because we assume that the special-permissions teams have broader access to folders (ie leads get access to a parent folder), at least for Launch Pad.
@codecov
Copy link

codecov bot commented Sep 28, 2020

Codecov Report

Merging #504 into master will decrease coverage by 0.77%.
The diff coverage is 58.82%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #504      +/-   ##
==========================================
- Coverage   94.40%   93.62%   -0.78%     
==========================================
  Files          46       46              
  Lines        2521     2590      +69     
  Branches      326      342      +16     
==========================================
+ Hits         2380     2425      +45     
- Misses         92      113      +21     
- Partials       49       52       +3     
Impacted Files Coverage Δ
interface/gcp_utils.py 34.48% <20.00%> (+5.45%) ⬆️
app/model/permissions.py 54.16% <38.88%> (-45.84%) ⬇️
db/utils.py 87.50% <50.00%> (-3.41%) ⬇️
app/controller/command/commands/team.py 85.81% <63.33%> (-2.12%) ⬇️
app/controller/command/commands/user.py 100.00% <100.00%> (ø)
config/__init__.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 515a35f...d0c8b23. Read the comment docs.

app/controller/command/commands/team.py Outdated Show resolved Hide resolved
app/controller/command/commands/team.py Outdated Show resolved Hide resolved
app/controller/command/commands/team.py Outdated Show resolved Hide resolved
config/__init__.py Show resolved Hide resolved
db/utils.py Outdated Show resolved Hide resolved
docs/Config.rst Show resolved Hide resolved
docs/Config.rst Show resolved Hide resolved
app/controller/command/commands/team.py Outdated Show resolved Hide resolved
app/controller/command/commands/team.py Show resolved Hide resolved
app/controller/command/commands/team.py Outdated Show resolved Hide resolved
app/controller/command/commands/team.py Outdated Show resolved Hide resolved
@bobheadxi
Copy link
Member Author

bobheadxi commented Sep 29, 2020

Brain keeps being lazy with these edge cases... added some tests: e3a89c5

app/controller/command/commands/team.py Show resolved Hide resolved
app/controller/command/commands/team.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@chuck-sys chuck-sys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not lie

no papa

Comment on lines +743 to +745
if user.permissions_level < t['permission']:
user.permissions_level = t['permission']
self.facade.store(user)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmmm yes that sextuple indent

@chuck-sys chuck-sys merged commit 509271e into master Sep 30, 2020
@chuck-sys chuck-sys deleted the permission-teams branch September 30, 2020 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

automatically grant leads team team_lead permission
2 participants