mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-04 08:27:27 +08:00
NET-2000: Api access tokens (#3418)
* feat: api access tokens * revoke all user tokens * redefine access token api routes, add auto egress option to enrollment keys * fix revoked tokens to be unauthorized * remove unused functions * convert access token to sql schema * switch access token to sql schema * revoke token generated by an user * add user token creation restriction by user role * add forbidden check for access token creation * revoke user token when group or role is changed * add default group to admin users on update * fix token removal on user update * fix token removal on user update
This commit is contained in:
11
database/utils.go
Normal file
11
database/utils.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package database
|
||||
|
||||
import "strings"
|
||||
|
||||
// IsEmptyRecord - checks for if it's an empty record error or not
|
||||
func IsEmptyRecord(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
return strings.Contains(err.Error(), NO_RECORD) || strings.Contains(err.Error(), NO_RECORDS)
|
||||
}
|
Reference in New Issue
Block a user