예제 #1
0
        public string DescribeAccess(string repoName, string user, CachedPermission level)
        {
            var repo = Repos.SingleOrDefault(r => r.Name == repoName);

            if (repo == null)
            {
                return(null);
            }

            if (Owners.Contains(user))
            {
                return("(Owner)");
            }

            foreach (var repoAccess in repo.Teams)
            {
                if (repoAccess.Permission == level)
                {
                    foreach (var team in repoAccess.Team.DescendentsAndSelf())
                    {
                        if (team.Members.Contains(user))
                        {
                            return(team.GetFullName());
                        }
                    }
                }
            }

            return("(Collaborator)");
        }