Skip to content

Commit

Permalink
PR changes
Browse files Browse the repository at this point in the history
Small PR changes
Updated to authaus v1.0.35
  • Loading branch information
bosvos committed Mar 13, 2024
1 parent 4c619fd commit 1ad2670
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/Overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ The fully documented API can be found [here](API.md).

The auth system has a CLI that can be used to perform various tasks. The CLI is
included in the `imqsauth` binary. It is recommended that the service itself be
shut down when the CLI is used.
shut down when the CLI is used, but not strictly required for all commands.

The CLI is invoked as follows:

Expand Down
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ module github.com/IMQS/imqsauth

go 1.18

replace github.com/IMQS/authaus v1.0.34 => ../authaus/

require (
github.com/IMQS/authaus v1.0.34
github.com/IMQS/authaus v1.0.35
github.com/IMQS/cli v0.0.0-20151022082634-156324308096
github.com/IMQS/gowinsvc v0.0.0-20220601052852-62ce07b0ae0b
github.com/IMQS/log v1.0.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
github.com/BurntSushi/migration v0.0.0-20140125045755-c45b897f1335 h1:n8o916boOorBHMGywZ+ucvUZRLIvjt2CaY/694CgMfU=
github.com/BurntSushi/migration v0.0.0-20140125045755-c45b897f1335/go.mod h1:eVEKGm5N/F2XPdHocE3gP//Ab+rb/54WJ7XXtFGxwaQ=
github.com/BurntSushi/toml v1.0.0 h1:dtDWrepsVPfW9H/4y7dDgFc2MBUSeJhlaDtK13CxFlU=
github.com/IMQS/authaus v1.0.34 h1:QToxw0ZPvoaKd/9EuA1xK99JW9E7bdpEqU20zRqvUXE=
github.com/IMQS/authaus v1.0.34/go.mod h1:Y8OTve3XI+DEagXTis8SwlgjQ4EIzd8iC+thTnWVITc=
github.com/IMQS/authaus v1.0.35 h1:TQQTOrAW8w3dsihuv6yxk6fYkEep8/DdCdEj6iz7MhU=
github.com/IMQS/authaus v1.0.35/go.mod h1:Y8OTve3XI+DEagXTis8SwlgjQ4EIzd8iC+thTnWVITc=
github.com/IMQS/cli v0.0.0-20151022082634-156324308096 h1:VffSY+13RAsa1X+AWA7/ftPqMoW76RHL+t4Ys6q43c0=
github.com/IMQS/cli v0.0.0-20151022082634-156324308096/go.mod h1:y2XQLPuROeqlwkjD/fieklY8cTCqFIh5OWNwsgrrwa8=
github.com/IMQS/gowinsvc v0.0.0-20220601052852-62ce07b0ae0b h1:UoYC6fmg+eG8QgfYiXEvzrAjXzqnvX4rOo50O7CXeZM=
Expand Down
4 changes: 2 additions & 2 deletions health/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func Check(ic *auth.ImqsCentral) bool {

var missingGroups map[authaus.GroupIDU32][]authaus.UserId
var groupKeys []authaus.GroupIDU32
useIdentities := errIdentities == nil || len(users) > 0
useIdentities := errIdentities == nil && len(users) > 0
if useIdentities {
stats := initUserStats()
typeCounts := initTypeCounts()
Expand Down Expand Up @@ -212,7 +212,7 @@ func FixDB(ic *auth.ImqsCentral) bool {
groupKeys := maps.Keys(missingGroups)
slices.SortFunc(groupKeys, func(a authaus.GroupIDU32, b authaus.GroupIDU32) int { return int(a) - int(b) })
for _, v := range groupKeys {
err := authaus.RemoveGroupFromAllUsers(ic.Central, strconv.Itoa(int(v)))
err := ic.Central.RemoveGroupFromAllUsers(strconv.Itoa(int(v)))
if err != nil {
fmt.Printf("Error cleaning group %v: %v\n", v, err)
}
Expand Down
6 changes: 1 addition & 5 deletions imqsauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ func main() {
app.DefaultExec = exec

app.AddCommand("createdb", "Create the postgres database")
healthCheckCommand := app.AddCommand("healthcheck", "Run a consistency check against the database")
healthCheckCommand.AddBoolOption("clean", "Clean all missing groups from all permits")
app.AddCommand("healthcheck", "Run a consistency check against the database")
app.AddCommand("resetauthgroups", "Reset the [admin,enabled] groups, and few others")
app.AddCommand("rollbackgroups", "Roll back undesired auto-created groups from September 2019")

Expand Down Expand Up @@ -427,9 +426,6 @@ func setGroup(icentral *auth.ImqsCentral, groupName string, roles []string) bool
return true
}

// cleanGroup
// Cycle through all users and remove the group from their permits

func createUser(icentral *auth.ImqsCentral, options map[string]string, identity string, password string) bool {

isEmail, _ := regexp.MatchString("^([\\w-]+(?:\\.[\\w-]+)*)@((?:[\\w-]+\\.)*\\w[\\w-]{0,66})\\.([a-z]{2,6}(?:\\.[a-z]{2})?)$", identity)
Expand Down

0 comments on commit 1ad2670

Please sign in to comment.