2024-03-25 16:24:48: merge [main:72a62d1996eb71f9a1ab21643bf294148b87ae99];

This commit is contained in:
txix committed 2024-03-25 16:24:48 +03:00
1 parent 0669c6ec0a
commit ed8a4eef5d
85 files changed
+7671 -93

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
package entity
import (
"time"
)
type Audit struct {
Id int
UserId int
Message string
Event string
CreatedAt time.Time
}
+14
View File
@@ -0,0 +1,14 @@
package entity
const (
EventSuccessLogin = "success_login"
EventErrorLogin = "error_login"
EventSuccessLogout = "success_logout"
EventRoleChanged = "role_changed"
EventUserChanged = "user_changed"
)
type AuditEvent struct {
Event string
Enable bool
}
+36
View File
@@ -0,0 +1,36 @@
package entity
import (
"database/sql/driver"
"time"
"github.com/integration-system/isp-kit/json"
)
const (
GroupOperationAdd = "ADD"
GroupOperationDelete = "DELETE"
)
type Role struct {
Id int
Name string
ExternalGroup string
Permissions PermList
Immutable bool
Exclusive bool
CreatedAt time.Time
UpdatedAt time.Time
}
type PermList []string
// nolint
func (p *PermList) Scan(src any) error {
return json.Unmarshal(src.([]byte), p)
}
func (p PermList) Value() (driver.Value, error) {
bytes, err := json.Marshal(p)
return driver.Value(bytes), err
}
+36
View File
@@ -0,0 +1,36 @@
// nolint:tagliatelle
package entity
import (
"fmt"
)
type SudirAuthError struct {
ErrorName string `json:"error"`
ErrorDescription string `json:"error_description"`
}
func (s *SudirAuthError) Error() string {
return fmt.Sprintf("error: %s; description: %s", s.ErrorName, s.ErrorDescription)
}
type SudirUserResponse struct {
*SudirAuthError
Email string `json:"email"`
Groups []string `json:"groups"`
Sub string `json:"sub"`
GivenName string `json:"given_name"`
FamilyName string `json:"family_name"`
}
type SudirTokenResponse struct {
*SudirAuthError
IdToken string `json:"id_token"`
AccessToken string `json:"access_token"`
ExpiresIn int `json:"expires_in"`
Scope string `json:"scope"`
RefreshToken string `json:"refresh_token"`
TokenType string `json:"token_type"`
}
+21
View File
@@ -0,0 +1,21 @@
package entity
import (
"time"
)
const (
TokenStatusAllowed = "ALLOWED"
TokenStatusRevoked = "REVOKED"
TokenStatusExpired = "EXPIRED"
)
type Token struct {
Id int
Token string
UserId int64
Status string
ExpiredAt time.Time
CreatedAt time.Time
UpdatedAt time.Time
}
+32
View File
@@ -0,0 +1,32 @@
package entity
import "time"
type User struct {
SudirUserId *string
Id int64
FirstName string
LastName string
Description string
Email string
Password string
Blocked bool
UpdatedAt time.Time
CreatedAt time.Time
}
type SudirUser struct {
RoleIds []int
SudirUserId string
FirstName string
LastName string
Email string
Description string
}
type UpdateUser struct {
FirstName string
LastName string
Email string
Description string
}
+6
View File
@@ -0,0 +1,6 @@
package entity
type UserRole struct {
UserId int
RoleId int
}