|
@@ -10,16 +10,17 @@ type NetworkID string
|
|
|
type RsrcType string
|
|
|
type RsrcID string
|
|
|
type UserRole string
|
|
|
+type UserGroupID string
|
|
|
|
|
|
const (
|
|
|
- HostRsrc RsrcType = "host"
|
|
|
- RelayRsrc RsrcType = "relay"
|
|
|
+ HostRsrc RsrcType = "hosts"
|
|
|
+ RelayRsrc RsrcType = "relays"
|
|
|
RemoteAccessGwRsrc RsrcType = "remote_access_gw"
|
|
|
InetGwRsrc RsrcType = "inet_gw"
|
|
|
EgressGwRsrc RsrcType = "egress"
|
|
|
NetworkRsrc RsrcType = "networks"
|
|
|
EnrollmentKeysRsrc RsrcType = "enrollment_key"
|
|
|
- UserRsrc RsrcType = "user"
|
|
|
+ UserRsrc RsrcType = "users"
|
|
|
AclRsrc RsrcType = "acl"
|
|
|
)
|
|
|
|
|
@@ -47,57 +48,57 @@ func (r UserRole) String() string {
|
|
|
return string(r)
|
|
|
}
|
|
|
|
|
|
-type RsrcPermissionScope struct {
|
|
|
- Create bool `json:"create"`
|
|
|
- Read bool `json:"read"`
|
|
|
- Update bool `json:"update"`
|
|
|
- Delete bool `json:"delete"`
|
|
|
+func (g UserGroupID) String() string {
|
|
|
+ return string(g)
|
|
|
}
|
|
|
|
|
|
-type NetworkAccessControls struct {
|
|
|
- NetworkID string `json:"network_id"`
|
|
|
- FullAccess bool `json:"full_access"`
|
|
|
- NetworkRsrcPermissionsScope map[RsrcType]map[RsrcID]RsrcPermissionScope `json:"network_permissions_list"`
|
|
|
+type RsrcPermissionScope struct {
|
|
|
+ Create bool `json:"create"`
|
|
|
+ Read bool `json:"read"`
|
|
|
+ Update bool `json:"update"`
|
|
|
+ Delete bool `json:"delete"`
|
|
|
+ VPNAccess bool `json:"vpn_access"`
|
|
|
}
|
|
|
|
|
|
-type DashboardAccessControls struct {
|
|
|
- FullAccess bool `json:"full_access"`
|
|
|
+type UserRolePermissionTemplate struct {
|
|
|
+ ID UserRole `json:"id"`
|
|
|
+ Default bool `json:"default"`
|
|
|
DenyDashboardAccess bool `json:"deny_dashboard_access"`
|
|
|
- NetworkLevelAccess map[NetworkID]NetworkAccessControls `json:"network_access_controls"`
|
|
|
+ FullAccess bool `json:"full_access"`
|
|
|
+ IsNetworkRole bool `json:"network_role"`
|
|
|
+ NetworkLevelAccess map[RsrcType]map[RsrcID]RsrcPermissionScope `json:"network_level_access"`
|
|
|
GlobalLevelAccess map[RsrcType]map[RsrcID]RsrcPermissionScope `json:"global_level_access"`
|
|
|
}
|
|
|
|
|
|
-type UserRolePermissionTemplate struct {
|
|
|
- ID UserRole `json:"id"`
|
|
|
- Default bool `json:"default"`
|
|
|
- DashBoardAcls DashboardAccessControls `json:"dashboard_access_controls"`
|
|
|
-}
|
|
|
-
|
|
|
type UserGroup struct {
|
|
|
- ID string `json:"id"`
|
|
|
- PermissionTemplate UserRolePermissionTemplate `json:"role_permission_template"`
|
|
|
- MetaData string `json:"meta_data"`
|
|
|
+ ID string `json:"id"`
|
|
|
+ NetworkRoles map[NetworkID]UserRole `json:"network_roles"`
|
|
|
+ MetaData string `json:"meta_data"`
|
|
|
}
|
|
|
|
|
|
// User struct - struct for Users
|
|
|
type User struct {
|
|
|
- UserName string `json:"username" bson:"username" validate:"min=3,max=40,in_charset|email"`
|
|
|
- Password string `json:"password" bson:"password" validate:"required,min=5"`
|
|
|
- IsAdmin bool `json:"isadmin" bson:"isadmin"`
|
|
|
- IsSuperAdmin bool `json:"issuperadmin"`
|
|
|
- RemoteGwIDs map[string]struct{} `json:"remote_gw_ids"`
|
|
|
- GroupID string `json:"group_id"`
|
|
|
- PermissionTemplate UserRolePermissionTemplate `json:"role_permission_template"`
|
|
|
- LastLoginTime time.Time `json:"last_login_time"`
|
|
|
+ UserName string `json:"username" bson:"username" validate:"min=3,max=40,in_charset|email"`
|
|
|
+ Password string `json:"password" bson:"password" validate:"required,min=5"`
|
|
|
+ IsAdmin bool `json:"isadmin" bson:"isadmin"`
|
|
|
+ IsSuperAdmin bool `json:"issuperadmin"`
|
|
|
+ RemoteGwIDs map[string]struct{} `json:"remote_gw_ids"`
|
|
|
+ UserGroups map[UserGroupID]struct{} `json:"user_groups"`
|
|
|
+ PlatformRoleID UserRole `json:"platform_role_id"`
|
|
|
+ NetworkRoles map[NetworkID]UserRole `json:"network_roles"`
|
|
|
+ LastLoginTime time.Time `json:"last_login_time"`
|
|
|
}
|
|
|
|
|
|
// ReturnUser - return user struct
|
|
|
type ReturnUser struct {
|
|
|
- UserName string `json:"username"`
|
|
|
- IsAdmin bool `json:"isadmin"`
|
|
|
- IsSuperAdmin bool `json:"issuperadmin"`
|
|
|
- RemoteGwIDs map[string]struct{} `json:"remote_gw_ids"`
|
|
|
- LastLoginTime time.Time `json:"last_login_time"`
|
|
|
+ UserName string `json:"username"`
|
|
|
+ IsAdmin bool `json:"isadmin"`
|
|
|
+ IsSuperAdmin bool `json:"issuperadmin"`
|
|
|
+ RemoteGwIDs map[string]struct{} `json:"remote_gw_ids"`
|
|
|
+ UserGroups map[UserGroupID]struct{} `json:"user_groups"`
|
|
|
+ PlatformRoleID string `json:"platform_role_id"`
|
|
|
+ NetworkRoles map[NetworkID]UserRole `json:"network_roles"`
|
|
|
+ LastLoginTime time.Time `json:"last_login_time"`
|
|
|
}
|
|
|
|
|
|
// UserAuthParams - user auth params struct
|