Hi, I want to autorize some users to access (read only) to all repositories ending by “-public”, I have more than 100 repositories and I continue to create new repository.
If it’s not possible , is it possible to filter for all “released” repositories ?
How can I create this role (and ay be I have to create a specific privilege)…
Thx
Michel
I don’t believe you can do this in Nexus. You could use the public REST APIs to retrieve the list of repositories, filter the names yourself and then use the REST API to update the role to include all appropriate repositories.
# pour gérer tous les privilèges de type "maven2" et "repository-view"
data "nexus_privileges" "priv_pub_read" {
format = "maven2"
type = "repository-view"
depends_on = [module.repository]
}
# affiche les privilèges public-browse et public-read
# debug
#output "privileges_all_read" {
# value = local.privileges_all_read
#}
# variable pour stocker les privilieges nommés "*public-browse" et "*public-read"
locals {
privileges_all_read = [for x in data.nexus_privileges.priv_pub_read.privileges:
x.name if can(regex("public-browse|public-read", x.name))
]
}
# il faut au prealable faire un import de tous les groupeAD deja migres avec la commande
# indus-all-acces-pub-read à boucler par script avant de lancer la 1ere fois
# creation/modification du role indus-all-acces-pub-read avec tous les privilèges "*public-browse" et "*public-read"
resource "nexus_security_role" "indus-all-acces-pub-read" {
description = "indus-all-acces-pub-read"
name = "indus-all-acces-pub-read"
roleid = "indus-all-acces-pub-read"
privileges = local.privileges_all_read
depends_on = [module.repository]
}