From c655e1246daa04abc4cd83dbb62b86dda1d357d4 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 7 Jun 2016 22:41:40 +0200 Subject: krebs.git: s/ensureList/toList/ --- krebs/3modules/git.nix | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'krebs') diff --git a/krebs/3modules/git.nix b/krebs/3modules/git.nix index d1ab2ce64..9bc56fc85 100644 --- a/krebs/3modules/git.nix +++ b/krebs/3modules/git.nix @@ -290,15 +290,15 @@ let environment.etc."${etc-base}".source = scriptFarm "git-ssh-authorizers" { authorize-command = makeAuthorizeScript (map (rule: [ - (map getName (ensureList rule.user)) - (map getName (ensureList rule.repo)) + (map getName (toList rule.user)) + (map getName (toList rule.repo)) (map getName rule.perm.allow-commands) ]) cfg.rules); authorize-push = makeAuthorizeScript (map (rule: [ - (map getName (ensureList rule.user)) - (map getName (ensureList rule.repo)) - (ensureList rule.perm.allow-receive-ref) + (map getName (toList rule.user)) + (map getName (toList rule.repo)) + (toList rule.perm.allow-receive-ref) (map getName rule.perm.allow-receive-modes) ]) (filter (rule: rule.perm.allow-receive-ref != null) cfg.rules)); }; @@ -400,10 +400,6 @@ let gid = fcgitwrap-user.uid; }; - - ensureList = x: - if typeOf x == "list" then x else [x]; - getName = x: x.name; isPublicRepo = getAttr "public"; # TODO this is also in ./cgit.nix @@ -428,7 +424,7 @@ let makeAuthorizeScript = let # TODO escape - to-pattern = x: concatStringsSep "|" (ensureList x); + to-pattern = x: concatStringsSep "|" (toList x); go = i: ps: if ps == [] then "exit 0" -- cgit v1.2.3