admin: Also generate associations when generating dex.yaml
This commit is contained in:
parent
2ce95ccafc
commit
d09c1741a2
2 changed files with 10 additions and 22 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"text/template"
|
||||
|
||||
|
@ -205,6 +206,14 @@ func genDexConfig() ([]byte, error) {
|
|||
}); err != nil {
|
||||
return nil, fmt.Errorf("An error occurs during template execution: %w", err)
|
||||
} else {
|
||||
// Also generate team associations
|
||||
for _, team := range teams {
|
||||
if err := os.Symlink(fmt.Sprintf("%d", team.Id), path.Join(TeamsDir, fmt.Sprintf("%02d", team.Id))); err != nil {
|
||||
log.Println("Unable to create association symlink:", err.Error())
|
||||
return nil, fmt.Errorf("Unable to create association symlink: %s", err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
return b.Bytes(), nil
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue