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
+10
View File
@@ -27,6 +27,8 @@ type LocalRepo struct {
Uploaders *Uploaders `codec:"Uploaders,omitempty" json:"-"`
// "Snapshot" of current list of packages
packageRefs *PackageRefList
// ldap group for repos
LdapGroup string `codec:",ldap-group"`
}
// NewLocalRepo creates new instance of Debian local repository
@@ -54,6 +56,14 @@ func (repo *LocalRepo) NumPackages() int {
return repo.packageRefs.Len()
}
// LdapGroup returns the ldapgroup if any for the repo
func (repo *LocalRepo) GetLDGroup() string {
if repo.LdapGroup != "" {
return fmt.Sprintf("[%s]", repo.LdapGroup)
}
return ""
}
// RefList returns package list for repo
func (repo *LocalRepo) RefList() *PackageRefList {
return repo.packageRefs