mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-26 22:39:07 +01:00
Merge branch 'feature/user-info-with-role-permissions' into feature/users-roles-endpoint
# Conflicts: # management/server/http/handlers/users/users_handler.go
This commit is contained in:
@@ -188,7 +188,6 @@ components:
|
||||
- auto_groups
|
||||
- status
|
||||
- is_blocked
|
||||
- permissions
|
||||
UserPermissions:
|
||||
type: object
|
||||
properties:
|
||||
|
||||
@@ -1677,8 +1677,8 @@ type User struct {
|
||||
LastLogin *time.Time `json:"last_login,omitempty"`
|
||||
|
||||
// Name User's name from idp provider
|
||||
Name string `json:"name"`
|
||||
Permissions UserPermissions `json:"permissions"`
|
||||
Name string `json:"name"`
|
||||
Permissions *UserPermissions `json:"permissions,omitempty"`
|
||||
|
||||
// Role User's NetBird account role
|
||||
Role string `json:"role"`
|
||||
|
||||
@@ -328,7 +328,7 @@ func toRolesResponse(roles map[types.UserRole]roles.RolePermissions) []api.RoleP
|
||||
func toUserWithPermissionsResponse(user *users.UserInfoWithPermissions, userID string) *api.User {
|
||||
response := toUserResponse(user.UserInfo, userID)
|
||||
|
||||
response.Permissions = api.UserPermissions{
|
||||
response.Permissions = &api.UserPermissions{
|
||||
IsRestricted: user.Restricted,
|
||||
Default: toOperationsMapResponse(user.Permissions.AutoAllowNew),
|
||||
Modules: toModulesMapResponse(user.Permissions.Permissions),
|
||||
|
||||
@@ -605,7 +605,7 @@ func TestCurrentUser(t *testing.T) {
|
||||
AutoGroups: []string{},
|
||||
Issued: ptr("api"),
|
||||
LastLogin: ptr(time.Time{}),
|
||||
Permissions: api.UserPermissions{
|
||||
Permissions: &api.UserPermissions{
|
||||
IsRestricted: false,
|
||||
Default: map[string]bool{
|
||||
"read": true,
|
||||
@@ -630,7 +630,7 @@ func TestCurrentUser(t *testing.T) {
|
||||
AutoGroups: []string{},
|
||||
Issued: ptr("api"),
|
||||
LastLogin: ptr(time.Time{}),
|
||||
Permissions: api.UserPermissions{
|
||||
Permissions: &api.UserPermissions{
|
||||
Default: map[string]bool{
|
||||
"read": false,
|
||||
"create": false,
|
||||
@@ -654,7 +654,7 @@ func TestCurrentUser(t *testing.T) {
|
||||
AutoGroups: []string{},
|
||||
Issued: ptr("api"),
|
||||
LastLogin: ptr(time.Time{}),
|
||||
Permissions: api.UserPermissions{
|
||||
Permissions: &api.UserPermissions{
|
||||
IsRestricted: false,
|
||||
Default: map[string]bool{
|
||||
"read": true,
|
||||
@@ -687,7 +687,7 @@ func TestCurrentUser(t *testing.T) {
|
||||
AutoGroups: []string{},
|
||||
Issued: ptr("api"),
|
||||
LastLogin: ptr(time.Time{}),
|
||||
Permissions: api.UserPermissions{
|
||||
Permissions: &api.UserPermissions{
|
||||
IsRestricted: true,
|
||||
Default: map[string]bool{
|
||||
"read": false,
|
||||
|
||||
Reference in New Issue
Block a user