mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-21 04:57:18 +02:00
directory: remove provider from user id (#2068)
This commit is contained in:
parent
a51c7140ea
commit
aeb8aaf9cd
18 changed files with 71 additions and 104 deletions
|
@ -5,23 +5,8 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// GetUserID gets the databroker user id from a provider user id.
|
||||
func GetUserID(provider, providerUserID string) string {
|
||||
return provider + "/" + providerUserID
|
||||
}
|
||||
|
||||
// FromUserID gets the provider and provider user id from a databroker user id.
|
||||
func FromUserID(userID string) (provider, providerUserID string) {
|
||||
ps := strings.SplitN(userID, "/", 2)
|
||||
if len(ps) < 2 {
|
||||
return "", userID
|
||||
}
|
||||
return ps[0], ps[1]
|
||||
}
|
||||
|
||||
// ApplyOffsetAndLimit applies the offset and limit to the list of records.
|
||||
func ApplyOffsetAndLimit(all []*Record, offset, limit int) (records []*Record, totalCount int) {
|
||||
records = all
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue