Adding authorisation options for API access

- ldap currently the only supported method
adding authorisation options for local repositories
  - ldap groups per repo
This commit is contained in:
bpiraeus
2022-03-13 16:07:21 -07:00
committed by André Roth
parent ab18da351d
commit 836137f15d
14 changed files with 358 additions and 66 deletions
+2
View File
@@ -18,6 +18,7 @@ func aptlyRepoCreate(cmd *commander.Command, args []string) error {
repo := deb.NewLocalRepo(args[0], context.Flags().Lookup("comment").Value.String())
repo.DefaultDistribution = context.Flags().Lookup("distribution").Value.String()
repo.DefaultComponent = context.Flags().Lookup("component").Value.String()
repo.LdapGroup = context.Flags().Lookup("ldap-group").Value.String()
uploadersFile := context.Flags().Lookup("uploaders-file").Value.Get().(string)
if uploadersFile != "" {
@@ -79,6 +80,7 @@ Example:
cmd.Flag.String("distribution", "", "default distribution when publishing")
cmd.Flag.String("component", "main", "default component when publishing")
cmd.Flag.String("uploaders-file", "", "uploaders.json to be used when including .changes into this repository")
cmd.Flag.String("ldap-group", "", "ldap group that owns the repo, leave empty to allow ALL")
return cmd
}
+3
View File
@@ -39,6 +39,8 @@ func aptlyRepoEdit(cmd *commander.Command, args []string) error {
repo.DefaultComponent = flag.Value.String()
case "uploaders-file":
uploadersFile = pointer.ToString(flag.Value.String())
case "ldap-group":
repo.LdapGroup = flag.Value.String()
}
})
@@ -82,6 +84,7 @@ Example:
cmd.Flag.String("distribution", "", "default distribution when publishing")
cmd.Flag.String("component", "", "default component when publishing")
cmd.Flag.String("uploaders-file", "", "uploaders.json to be used when including .changes into this repository")
cmd.Flag.String("ldap-group", "", "ldap group that owns the repo, leave empty to allow ALL")
return cmd
}
+1
View File
@@ -45,6 +45,7 @@ func aptlyRepoShowTxt(_ *commander.Command, args []string) error {
fmt.Printf("Comment: %s\n", repo.Comment)
fmt.Printf("Default Distribution: %s\n", repo.DefaultDistribution)
fmt.Printf("Default Component: %s\n", repo.DefaultComponent)
fmt.Printf("Ldap Group: %s\n", repo.LdapGroup)
if repo.Uploaders != nil {
fmt.Printf("Uploaders: %s\n", repo.Uploaders)
}