Browse Source

read and write acl defaults are now read from the [cpi:/] section

master
Holger Frey 10 years ago
parent
commit
18c3f53dfc
  1. 5
      authz
  2. 25
      manage.py

5
authz

@ -2,10 +2,10 @@
administrators = OswaldPrucker administrators = OswaldPrucker
restricted = AndreasEver, ArthurMartens, BeniPrasser, JuliaSaar, SimonZunker, SirasaYodmongkol, UrmilShah, YongZhou restricted = AndreasEver, ArthurMartens, BeniPrasser, JuliaSaar, SimonZunker, SirasaYodmongkol, UrmilShah, YongZhou
alumni = AlexeyKopyshev, AndreasBoenisch, AnkeWoerz, AnneLoesche, ArulGeetha, ChristianSchuh, ChristineBunte, CkPandiyarajan, FanWu, GinoRodriguez, GuillermoBenites, HeikeHaller, IrenaEipert, JacobBelardi, JenniferPfau, JoachimLauterwasser, JohannesBaader, KatrinMoosmann, KerstinSchuh, KimberlySimancas, MarcelHoffmann, MarcoArmbruster, MariaVoehringer, MariaVohringer, MartinaAuerswald, MartinVellinger, MatthiasLischka, MessRechner, MichaelaFrase, MiriamScheckenbach, MonicaPerez, MonikaKurowska, NinoLomadze, Nongluck, OliverDornfeld, PeterZahn, PhilippDiefenthaler, PhilippWollermann, RodrigoNavarro, SaraFuchs, SebastianBoehmer, SebastianSebald, SimonBodendorfer, SimonSchuster, ThidaratWangkam, TobiasKoenig, TristanBourrel, UlrikeRiehle, ViVek, WolfgangEhm, YnSekhar, ZouStaarter alumni = AlexeyKopyshev, AndreasBoenisch, AnkeWoerz, AnneLoesche, ArulGeetha, ChristianSchuh, ChristineBunte, CkPandiyarajan, FanWu, GinoRodriguez, GuillermoBenites, HeikeHaller, IrenaEipert, JacobBelardi, JenniferPfau, JoachimLauterwasser, JohannesBaader, KatrinMoosmann, KerstinSchuh, KimberlySimancas, MarcelHoffmann, MarcoArmbruster, MariaVoehringer, MariaVohringer, MartinaAuerswald, MartinVellinger, MatthiasLischka, MessRechner, MichaelaFrase, MiriamScheckenbach, MonicaPerez, MonikaKurowska, NinoLomadze, Nongluck, OliverDornfeld, PeterZahn, PhilippDiefenthaler, PhilippWollermann, RodrigoNavarro, SaraFuchs, SebastianBoehmer, SebastianSebald, SimonBodendorfer, SimonSchuster, ThidaratWangkam, TobiasKoenig, TristanBourrel, UlrikeRiehle, ViVek, WolfgangEhm, YnSekhar, ZouStaarter
users = AlexanderDietz, AliciaMalekLuz, AndreasMader, AnnaSchuler, AnneBuderer, CanerKaganaslan, ChristophScheibelein, DanielaMoessner, DavidBoschert, DavidSchwaerzle, FrankScherag, FranziskaDorner, GerhardBaaken, GregorOsterwinter, HolgerFrey, JanNiklasSchoenberg, JonGreen, KarenLienkamp, KeLi, MalwinaPajestka, MaraFlorea, MarcelRothfelder, MarcZinggeler, MarcelHoffmann, MartinKoerner, MartinRendl, MartinSchoenstein, MatthiasMenzel, MelanieEichhorn, MichaelHenze, MostafaMahmoud, NataliaSchatz, NicoleBirsner, NilsKorf, PetraHettich, PhilipKotrade, RaduCristianMutihac, RebeccaBlell, RomanErath, SamarKazan, SaschaEngel, ShararehSahneh, SureshReddyBanda, ThomasBrandstetter, TianyangZheng, TobiasHeitzler, VinicioCarias, VitaliyKondrashov, WibkeHartleb, XiaoqiangHou users = AlexanderDietz, AliciaMalekLuz, AndreasMader, AnnaSchuler, AnneBuderer, CanerKaganaslan, ChristophScheibelein, DanielaMoessner, DavidBoschert, DavidSchwaerzle, FrankScherag, FranziskaDorner, GerhardBaaken, GregorOsterwinter, HolgerFrey, JanNiklasSchoenberg, JonGreen, KarenLienkamp, KeLi, MalwinaPajestka, MaraFlorea, MarcelRothfelder, MarcZinggeler, MartinKoerner, MartinRendl, MartinSchoenstein, MatthiasMenzel, MelanieEichhorn, MichaelHenze, MostafaMahmoud, NataliaSchatz, NicoleBirsner, NilsKorf, PetraHettich, PhilipKotrade, RaduCristianMutihac, RebeccaBlell, RomanErath, SamarKazan, SaschaEngel, ShararehSahneh, SureshReddyBanda, ThomasBrandstetter, TianyangZheng, TobiasHeitzler, VinicioCarias, VitaliyKondrashov, WibkeHartleb, XiaoqiangHou
[cpi:/] [cpi:/]
@admins = rw @administrators = rw
@users = r @users = r
@restricted = r @restricted = r
@alumni = @alumni =
@ -290,6 +290,7 @@ NilsKorf = rw
[cpi:/OswaldPrucker] [cpi:/OswaldPrucker]
@restricted = @restricted =
@users =
[cpi:/PengZou] [cpi:/PengZou]
@restricted = @restricted =

25
manage.py

@ -79,12 +79,17 @@ class AuthzConfigParser(ConfigParser.ConfigParser, object):
def __init__(self): def __init__(self):
""" initialization of the class """ """ initialization of the class """
self.users = None self.users = None
self._acl_defaults = { WRITE_ACL: [], READ_ACL: [] }
super(AuthzConfigParser, self).__init__() super(AuthzConfigParser, self).__init__()
def optionxform(self, value): def optionxform(self, value):
""" reset the method to use cases ensitive names """ """ reset the method to use cases ensitive names """
return str(value) return str(value)
def read(self, path):
super(AuthzConfigParser, self).read(path)
self._acl_defaults = self.get_folder_info("")
def extract_users(self): def extract_users(self):
""" extract user information from config """ """ extract user information from config """
users = dict() users = dict()
@ -116,10 +121,14 @@ class AuthzConfigParser(ConfigParser.ConfigParser, object):
name = SVN_BASE + name name = SVN_BASE + name
if not self.has_section(name): if not self.has_section(name):
return None return None
info = { WRITE_ACL: [], READ_ACL: [] } info = self._acl_defaults.copy()
for (option, value) in self.items(name): for (option, value) in self.items(name):
if value in (WRITE_ACL, READ_ACL): if value in (WRITE_ACL, READ_ACL):
info[value].append(option) info[value].append(option)
if not value:
for acltype in (WRITE_ACL, READ_ACL):
if option in info[acltype]:
info[acltype].remove(option)
return info return info
def move_user_to_alumni(self, user): def move_user_to_alumni(self, user):
@ -282,7 +291,13 @@ if __name__ == "__main__":
print " Read access is NOT granted to any folder" print " Read access is NOT granted to any folder"
info = config.get_folder_info(name) info = config.get_folder_info(name)
print "Labjornal %s%s:" % (SVN_BASE, name) print "Labjornal %s%s:" % (SVN_BASE, name)
write_acl = [ "@" + ADMINS ] + info[WRITE_ACL] if info[WRITE_ACL]:
print " Write access granted to " + ", ".join(write_acl) print " Write and read access granted to: " + ", ".join(info[WRITE_ACL])
read_acl = [ "@" + ADMINS, "@" + REGULAR ] + info[READ_ACL] else:
print " Read access granted to: " + ", ".join(read_acl) print " No write access granted to anybody"
if info[READ_ACL]:
print " Read access granted to: " + ", ".join(info[READ_ACL])
else:
print " No read access granted to anybody"

Loading…
Cancel
Save