We need to give a user access to all repos they have view access of the projects.
Second potential functionality give a staff member access to all repos that belong to:
a specific user
all users in a team
What are you up to? Fill us in :)
Screenshots/videos
This makes use of the already existing invite_github_collaborators_to_repo method inside the RecruitProject model. Here is a snippet of it:
def invite_github_collaborators_to_repo(self):
from social_auth.github_api import Api
from social_auth.models import SocialProfile
from git_real.helpers import add_collaborator, list_collaborators
api = Api(GIT_REAL_BOT_USERNAME)
repo = self.repository
existing_collaborators = list_collaborators(api, repo.full_name)
collaborator_users = {
"reviewer users": list(self.reviewer_users.filter(active=True)),
"assigned users": list(self.recruit_users.filter(active=True)),
"users with explicit permission": self.get_users_with_permission(
Team.PERMISSION_REPO_COLLABORATER_AUTO_ADD
),
}
specifically, the users with explicit permission part. Team.PERMISSION_REPO_COLLABORATER_AUTO_ADD is a group of permissions as defined here:
class Team(AuthGroup, Mixins):
...
PERMISSION_REPO_COLLABORATER_AUTO_ADD = [
# when a repo is created then folks with these permissions get added to the repo as collaborators
PERMISSION_MANAGE_CARDS,
PERMISSION_VIEW_ALL,
PERMISSION_ASSIGN_REVIEWERS,
PERMISSION_REVIEW_CARDS,
]
...
This new action basically "refreshes" github collaborators based on these permissions. So if new staff "john" and "sarah" have the same perms to a certain team, doing it for "john" would be enough to give both staff members access to their repos.
I solemnly swear that:
[x] My code follows the style guidelines of this project
[x] I have merged the develop branch into my branch and fixed any merge conflicts
[x] I have performed a self-review of my own code
[ ] I have commented my code in hard-to-understand areas
[x] My changes generate no new warnings
[ ] I have added tests that prove my fix is effective or that my feature works
[x] I have tested new or existing tests and made sure that they pass
Related issues: [please specify]
Description:
Functionality should be in the Admin panel
We need to give a user access to all repos they have view access of the projects.
Second potential functionality give a staff member access to all repos that belong to:
What are you up to? Fill us in :)
Screenshots/videos
This makes use of the already existing
invite_github_collaborators_to_repo
method inside theRecruitProject
model. Here is a snippet of it:specifically, the
users with explicit permission
part.Team.PERMISSION_REPO_COLLABORATER_AUTO_ADD
is a group of permissions as defined here:This new action basically "refreshes" github collaborators based on these permissions. So if new staff "john" and "sarah" have the same perms to a certain team, doing it for "john" would be enough to give both staff members access to their repos.
I solemnly swear that: