- commit
- 05c1dd367db183366a5cb1012ffc295f59e0508c
- parent
- 4c226c58ec59049b0b6ae7e4d030b1d8bef8fd16
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2020-04-23 06:55
rm groups
Diffstat
M | README.md | 19 | +++++++------------ |
M | gitolite/stagit.py | 11 | ++--------- |
2 files changed, 9 insertions, 21 deletions
diff --git a/README.md b/README.md
@@ -29,25 +29,20 @@ Then setup access control: 29 29 ## stagit.conf 30 30 31 31 ```32 -1 [GROUPS]33 -1 @staff = dilbert alice34 -135 32 [private]36 -1 ssh = admin-1 33 ssh = admin dilbert 37 34 38 35 [example] 39 36 desc = my shiny new project40 -1 ssh = @staff-1 37 ssh = @all 41 38 http = yes 42 39 ``` 43 4044 -1 Every section defines one repo, except for the special `GROUPS` section which45 -1 can be used to define groups of users. The special group `@all` matches all46 -1 users.47 -148 -1 The `ssh` key controls which users can access the repositories via ssh. The49 -1 `http` key is boolean and enables anonymous access via website and50 -1 [git-daemon](https://git-scm.com/book/en/v2/Git-on-the-Server-Git-Daemon).-1 41 - Every section defines one repo. -1 42 - The `ssh` key controls which users can access the repositories via ssh. -1 43 - The special user `@all` matches all users. -1 44 - The `http` key is boolean and enables anonymous access via website and -1 45 [git-daemon](https://git-scm.com/book/en/v2/Git-on-the-Server-Git-Daemon). 51 46 52 47 ## Authorized keys 53 48
diff --git a/gitolite/stagit.py b/gitolite/stagit.py
@@ -35,19 +35,12 @@ class Config: 35 35 return self.config.getboolean(section, key, fallback=False) 36 36 37 37 def can_ssh(self, repo, user):38 -1 users = set([user, '@all'])39 -1 try:40 -1 for group, value in self.config['GROUPS'].items():41 -1 if user in value.split():42 -1 users.add(group)43 -1 except KeyError:44 -1 pass45 38 allowed = self.get(repo, 'ssh').split()46 -1 return not users.isdisjoint(allowed)-1 39 return user in allowed or '@all' in allowed 47 40 48 41 def iter_repos(self): 49 42 for key in self.config:50 -1 if key not in ['GROUPS', 'DEFAULT']:-1 43 if key != 'DEFAULT': 51 44 yield key 52 45 53 46