File tree 1 file changed +24
-8
lines changed
1 file changed +24
-8
lines changed Original file line number Diff line number Diff line change @@ -45,14 +45,30 @@ impl Job for ProjectGoalsUpdateJob {
45
45
46
46
/// Returns true if the user with the given github id is allowed to ping all group people
47
47
/// and do other "project group adminstrative" tasks.
48
- pub async fn check_project_goal_acl ( _gh : & GithubClient , gh_id : u64 ) -> anyhow:: Result < bool > {
49
- /// Github ID of the user allowed to ping all group people.
50
- ///
51
- /// FIXME: We should create a team for the person/people managing the goals program
52
- /// and check that the zulip person is on it, but I'm too
53
- const GOAL_OWNER_GH_ID : u64 = 155238 ; // nikomatsakis
54
-
55
- Ok ( gh_id == GOAL_OWNER_GH_ID )
48
+ pub async fn check_project_goal_acl ( gh : & GithubClient , gh_id : u64 ) -> anyhow:: Result < bool > {
49
+ const GOALS_TEAM : & str = "goals" ;
50
+
51
+ let team = match github:: get_team ( gh, GOALS_TEAM ) . await {
52
+ Ok ( Some ( team) ) => team,
53
+ Ok ( None ) => {
54
+ log:: info!( "team ({}) failed to resolve to a known team" , GOALS_TEAM ) ;
55
+ return Ok ( false ) ;
56
+ }
57
+ Err ( err) => {
58
+ log:: error!(
59
+ "team ({}) failed to resolve to a known team: {:?}" ,
60
+ GOALS_TEAM ,
61
+ err
62
+ ) ;
63
+ return Ok ( false ) ;
64
+ }
65
+ } ;
66
+
67
+ Ok ( team
68
+ . members
69
+ . into_iter ( )
70
+ . find ( |member| member. github_id == gh_id)
71
+ . is_some ( ) )
56
72
}
57
73
58
74
async fn ping_project_goals_owners_automatically ( gh : & GithubClient ) -> anyhow:: Result < ( ) > {
You can’t perform that action at this time.
0 commit comments