diff --git a/channels/mocks/repository.go b/channels/mocks/repository.go index 6feb79682f..930f8b52c1 100644 --- a/channels/mocks/repository.go +++ b/channels/mocks/repository.go @@ -443,6 +443,34 @@ func (_m *Repository) RetrieveEntitiesRolesActionsMembers(ctx context.Context, e return r0, r1, r2 } +// RetrieveEntityRole provides a mock function with given fields: ctx, entityID, roleID +func (_m *Repository) RetrieveEntityRole(ctx context.Context, entityID string, roleID string) (roles.Role, error) { + ret := _m.Called(ctx, entityID, roleID) + + if len(ret) == 0 { + panic("no return value specified for RetrieveEntityRole") + } + + var r0 roles.Role + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, string) (roles.Role, error)); ok { + return rf(ctx, entityID, roleID) + } + if rf, ok := ret.Get(0).(func(context.Context, string, string) roles.Role); ok { + r0 = rf(ctx, entityID, roleID) + } else { + r0 = ret.Get(0).(roles.Role) + } + + if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { + r1 = rf(ctx, entityID, roleID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // RetrieveParentGroupChannels provides a mock function with given fields: ctx, parentGroupID func (_m *Repository) RetrieveParentGroupChannels(ctx context.Context, parentGroupID string) ([]channels.Channel, error) { ret := _m.Called(ctx, parentGroupID) @@ -501,34 +529,6 @@ func (_m *Repository) RetrieveRole(ctx context.Context, roleID string) (roles.Ro return r0, r1 } -// RetrieveRoleByEntityIDAndName provides a mock function with given fields: ctx, entityID, roleName -func (_m *Repository) RetrieveRoleByEntityIDAndName(ctx context.Context, entityID string, roleName string) (roles.Role, error) { - ret := _m.Called(ctx, entityID, roleName) - - if len(ret) == 0 { - panic("no return value specified for RetrieveRoleByEntityIDAndName") - } - - var r0 roles.Role - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, string) (roles.Role, error)); ok { - return rf(ctx, entityID, roleName) - } - if rf, ok := ret.Get(0).(func(context.Context, string, string) roles.Role); ok { - r0 = rf(ctx, entityID, roleName) - } else { - r0 = ret.Get(0).(roles.Role) - } - - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(ctx, entityID, roleName) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - // RoleAddActions provides a mock function with given fields: ctx, role, actions func (_m *Repository) RoleAddActions(ctx context.Context, role roles.Role, actions []string) ([]string, error) { ret := _m.Called(ctx, role, actions) diff --git a/channels/mocks/service.go b/channels/mocks/service.go index 464b19dd17..0f625b81d7 100644 --- a/channels/mocks/service.go +++ b/channels/mocks/service.go @@ -319,9 +319,9 @@ func (_m *Service) RemoveParentGroup(ctx context.Context, session authn.Session, return r0 } -// RemoveRole provides a mock function with given fields: ctx, session, entityID, roleName -func (_m *Service) RemoveRole(ctx context.Context, session authn.Session, entityID string, roleName string) error { - ret := _m.Called(ctx, session, entityID, roleName) +// RemoveRole provides a mock function with given fields: ctx, session, entityID, roleID +func (_m *Service) RemoveRole(ctx context.Context, session authn.Session, entityID string, roleID string) error { + ret := _m.Called(ctx, session, entityID, roleID) if len(ret) == 0 { panic("no return value specified for RemoveRole") @@ -329,7 +329,7 @@ func (_m *Service) RemoveRole(ctx context.Context, session authn.Session, entity var r0 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) error); ok { - r0 = rf(ctx, session, entityID, roleName) + r0 = rf(ctx, session, entityID, roleID) } else { r0 = ret.Error(0) } @@ -365,9 +365,9 @@ func (_m *Service) RetrieveAllRoles(ctx context.Context, session authn.Session, return r0, r1 } -// RetrieveRole provides a mock function with given fields: ctx, session, entityID, roleName -func (_m *Service) RetrieveRole(ctx context.Context, session authn.Session, entityID string, roleName string) (roles.Role, error) { - ret := _m.Called(ctx, session, entityID, roleName) +// RetrieveRole provides a mock function with given fields: ctx, session, entityID, roleID +func (_m *Service) RetrieveRole(ctx context.Context, session authn.Session, entityID string, roleID string) (roles.Role, error) { + ret := _m.Called(ctx, session, entityID, roleID) if len(ret) == 0 { panic("no return value specified for RetrieveRole") @@ -376,16 +376,16 @@ func (_m *Service) RetrieveRole(ctx context.Context, session authn.Session, enti var r0 roles.Role var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) (roles.Role, error)); ok { - return rf(ctx, session, entityID, roleName) + return rf(ctx, session, entityID, roleID) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) roles.Role); ok { - r0 = rf(ctx, session, entityID, roleName) + r0 = rf(ctx, session, entityID, roleID) } else { r0 = ret.Get(0).(roles.Role) } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string) error); ok { - r1 = rf(ctx, session, entityID, roleName) + r1 = rf(ctx, session, entityID, roleID) } else { r1 = ret.Error(1) } @@ -393,9 +393,9 @@ func (_m *Service) RetrieveRole(ctx context.Context, session authn.Session, enti return r0, r1 } -// RoleAddActions provides a mock function with given fields: ctx, session, entityID, roleName, actions -func (_m *Service) RoleAddActions(ctx context.Context, session authn.Session, entityID string, roleName string, actions []string) ([]string, error) { - ret := _m.Called(ctx, session, entityID, roleName, actions) +// RoleAddActions provides a mock function with given fields: ctx, session, entityID, roleID, actions +func (_m *Service) RoleAddActions(ctx context.Context, session authn.Session, entityID string, roleID string, actions []string) ([]string, error) { + ret := _m.Called(ctx, session, entityID, roleID, actions) if len(ret) == 0 { panic("no return value specified for RoleAddActions") @@ -404,10 +404,10 @@ func (_m *Service) RoleAddActions(ctx context.Context, session authn.Session, en var r0 []string var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) ([]string, error)); ok { - return rf(ctx, session, entityID, roleName, actions) + return rf(ctx, session, entityID, roleID, actions) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) []string); ok { - r0 = rf(ctx, session, entityID, roleName, actions) + r0 = rf(ctx, session, entityID, roleID, actions) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]string) @@ -415,7 +415,7 @@ func (_m *Service) RoleAddActions(ctx context.Context, session authn.Session, en } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, []string) error); ok { - r1 = rf(ctx, session, entityID, roleName, actions) + r1 = rf(ctx, session, entityID, roleID, actions) } else { r1 = ret.Error(1) } @@ -423,9 +423,9 @@ func (_m *Service) RoleAddActions(ctx context.Context, session authn.Session, en return r0, r1 } -// RoleAddMembers provides a mock function with given fields: ctx, session, entityID, roleName, members -func (_m *Service) RoleAddMembers(ctx context.Context, session authn.Session, entityID string, roleName string, members []string) ([]string, error) { - ret := _m.Called(ctx, session, entityID, roleName, members) +// RoleAddMembers provides a mock function with given fields: ctx, session, entityID, roleID, members +func (_m *Service) RoleAddMembers(ctx context.Context, session authn.Session, entityID string, roleID string, members []string) ([]string, error) { + ret := _m.Called(ctx, session, entityID, roleID, members) if len(ret) == 0 { panic("no return value specified for RoleAddMembers") @@ -434,10 +434,10 @@ func (_m *Service) RoleAddMembers(ctx context.Context, session authn.Session, en var r0 []string var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) ([]string, error)); ok { - return rf(ctx, session, entityID, roleName, members) + return rf(ctx, session, entityID, roleID, members) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) []string); ok { - r0 = rf(ctx, session, entityID, roleName, members) + r0 = rf(ctx, session, entityID, roleID, members) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]string) @@ -445,7 +445,7 @@ func (_m *Service) RoleAddMembers(ctx context.Context, session authn.Session, en } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, []string) error); ok { - r1 = rf(ctx, session, entityID, roleName, members) + r1 = rf(ctx, session, entityID, roleID, members) } else { r1 = ret.Error(1) } @@ -453,9 +453,9 @@ func (_m *Service) RoleAddMembers(ctx context.Context, session authn.Session, en return r0, r1 } -// RoleCheckActionsExists provides a mock function with given fields: ctx, session, entityID, roleName, actions -func (_m *Service) RoleCheckActionsExists(ctx context.Context, session authn.Session, entityID string, roleName string, actions []string) (bool, error) { - ret := _m.Called(ctx, session, entityID, roleName, actions) +// RoleCheckActionsExists provides a mock function with given fields: ctx, session, entityID, roleID, actions +func (_m *Service) RoleCheckActionsExists(ctx context.Context, session authn.Session, entityID string, roleID string, actions []string) (bool, error) { + ret := _m.Called(ctx, session, entityID, roleID, actions) if len(ret) == 0 { panic("no return value specified for RoleCheckActionsExists") @@ -464,16 +464,16 @@ func (_m *Service) RoleCheckActionsExists(ctx context.Context, session authn.Ses var r0 bool var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) (bool, error)); ok { - return rf(ctx, session, entityID, roleName, actions) + return rf(ctx, session, entityID, roleID, actions) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) bool); ok { - r0 = rf(ctx, session, entityID, roleName, actions) + r0 = rf(ctx, session, entityID, roleID, actions) } else { r0 = ret.Get(0).(bool) } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, []string) error); ok { - r1 = rf(ctx, session, entityID, roleName, actions) + r1 = rf(ctx, session, entityID, roleID, actions) } else { r1 = ret.Error(1) } @@ -481,9 +481,9 @@ func (_m *Service) RoleCheckActionsExists(ctx context.Context, session authn.Ses return r0, r1 } -// RoleCheckMembersExists provides a mock function with given fields: ctx, session, entityID, roleName, members -func (_m *Service) RoleCheckMembersExists(ctx context.Context, session authn.Session, entityID string, roleName string, members []string) (bool, error) { - ret := _m.Called(ctx, session, entityID, roleName, members) +// RoleCheckMembersExists provides a mock function with given fields: ctx, session, entityID, roleID, members +func (_m *Service) RoleCheckMembersExists(ctx context.Context, session authn.Session, entityID string, roleID string, members []string) (bool, error) { + ret := _m.Called(ctx, session, entityID, roleID, members) if len(ret) == 0 { panic("no return value specified for RoleCheckMembersExists") @@ -492,16 +492,16 @@ func (_m *Service) RoleCheckMembersExists(ctx context.Context, session authn.Ses var r0 bool var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) (bool, error)); ok { - return rf(ctx, session, entityID, roleName, members) + return rf(ctx, session, entityID, roleID, members) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) bool); ok { - r0 = rf(ctx, session, entityID, roleName, members) + r0 = rf(ctx, session, entityID, roleID, members) } else { r0 = ret.Get(0).(bool) } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, []string) error); ok { - r1 = rf(ctx, session, entityID, roleName, members) + r1 = rf(ctx, session, entityID, roleID, members) } else { r1 = ret.Error(1) } @@ -509,9 +509,9 @@ func (_m *Service) RoleCheckMembersExists(ctx context.Context, session authn.Ses return r0, r1 } -// RoleListActions provides a mock function with given fields: ctx, session, entityID, roleName -func (_m *Service) RoleListActions(ctx context.Context, session authn.Session, entityID string, roleName string) ([]string, error) { - ret := _m.Called(ctx, session, entityID, roleName) +// RoleListActions provides a mock function with given fields: ctx, session, entityID, roleID +func (_m *Service) RoleListActions(ctx context.Context, session authn.Session, entityID string, roleID string) ([]string, error) { + ret := _m.Called(ctx, session, entityID, roleID) if len(ret) == 0 { panic("no return value specified for RoleListActions") @@ -520,10 +520,10 @@ func (_m *Service) RoleListActions(ctx context.Context, session authn.Session, e var r0 []string var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) ([]string, error)); ok { - return rf(ctx, session, entityID, roleName) + return rf(ctx, session, entityID, roleID) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) []string); ok { - r0 = rf(ctx, session, entityID, roleName) + r0 = rf(ctx, session, entityID, roleID) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]string) @@ -531,7 +531,7 @@ func (_m *Service) RoleListActions(ctx context.Context, session authn.Session, e } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string) error); ok { - r1 = rf(ctx, session, entityID, roleName) + r1 = rf(ctx, session, entityID, roleID) } else { r1 = ret.Error(1) } @@ -539,9 +539,9 @@ func (_m *Service) RoleListActions(ctx context.Context, session authn.Session, e return r0, r1 } -// RoleListMembers provides a mock function with given fields: ctx, session, entityID, roleName, limit, offset -func (_m *Service) RoleListMembers(ctx context.Context, session authn.Session, entityID string, roleName string, limit uint64, offset uint64) (roles.MembersPage, error) { - ret := _m.Called(ctx, session, entityID, roleName, limit, offset) +// RoleListMembers provides a mock function with given fields: ctx, session, entityID, roleID, limit, offset +func (_m *Service) RoleListMembers(ctx context.Context, session authn.Session, entityID string, roleID string, limit uint64, offset uint64) (roles.MembersPage, error) { + ret := _m.Called(ctx, session, entityID, roleID, limit, offset) if len(ret) == 0 { panic("no return value specified for RoleListMembers") @@ -550,16 +550,16 @@ func (_m *Service) RoleListMembers(ctx context.Context, session authn.Session, e var r0 roles.MembersPage var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, uint64, uint64) (roles.MembersPage, error)); ok { - return rf(ctx, session, entityID, roleName, limit, offset) + return rf(ctx, session, entityID, roleID, limit, offset) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, uint64, uint64) roles.MembersPage); ok { - r0 = rf(ctx, session, entityID, roleName, limit, offset) + r0 = rf(ctx, session, entityID, roleID, limit, offset) } else { r0 = ret.Get(0).(roles.MembersPage) } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, uint64, uint64) error); ok { - r1 = rf(ctx, session, entityID, roleName, limit, offset) + r1 = rf(ctx, session, entityID, roleID, limit, offset) } else { r1 = ret.Error(1) } @@ -567,9 +567,9 @@ func (_m *Service) RoleListMembers(ctx context.Context, session authn.Session, e return r0, r1 } -// RoleRemoveActions provides a mock function with given fields: ctx, session, entityID, roleName, actions -func (_m *Service) RoleRemoveActions(ctx context.Context, session authn.Session, entityID string, roleName string, actions []string) error { - ret := _m.Called(ctx, session, entityID, roleName, actions) +// RoleRemoveActions provides a mock function with given fields: ctx, session, entityID, roleID, actions +func (_m *Service) RoleRemoveActions(ctx context.Context, session authn.Session, entityID string, roleID string, actions []string) error { + ret := _m.Called(ctx, session, entityID, roleID, actions) if len(ret) == 0 { panic("no return value specified for RoleRemoveActions") @@ -577,7 +577,7 @@ func (_m *Service) RoleRemoveActions(ctx context.Context, session authn.Session, var r0 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) error); ok { - r0 = rf(ctx, session, entityID, roleName, actions) + r0 = rf(ctx, session, entityID, roleID, actions) } else { r0 = ret.Error(0) } @@ -585,9 +585,9 @@ func (_m *Service) RoleRemoveActions(ctx context.Context, session authn.Session, return r0 } -// RoleRemoveAllActions provides a mock function with given fields: ctx, session, entityID, roleName -func (_m *Service) RoleRemoveAllActions(ctx context.Context, session authn.Session, entityID string, roleName string) error { - ret := _m.Called(ctx, session, entityID, roleName) +// RoleRemoveAllActions provides a mock function with given fields: ctx, session, entityID, roleID +func (_m *Service) RoleRemoveAllActions(ctx context.Context, session authn.Session, entityID string, roleID string) error { + ret := _m.Called(ctx, session, entityID, roleID) if len(ret) == 0 { panic("no return value specified for RoleRemoveAllActions") @@ -595,7 +595,7 @@ func (_m *Service) RoleRemoveAllActions(ctx context.Context, session authn.Sessi var r0 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) error); ok { - r0 = rf(ctx, session, entityID, roleName) + r0 = rf(ctx, session, entityID, roleID) } else { r0 = ret.Error(0) } @@ -603,9 +603,9 @@ func (_m *Service) RoleRemoveAllActions(ctx context.Context, session authn.Sessi return r0 } -// RoleRemoveAllMembers provides a mock function with given fields: ctx, session, entityID, roleName -func (_m *Service) RoleRemoveAllMembers(ctx context.Context, session authn.Session, entityID string, roleName string) error { - ret := _m.Called(ctx, session, entityID, roleName) +// RoleRemoveAllMembers provides a mock function with given fields: ctx, session, entityID, roleID +func (_m *Service) RoleRemoveAllMembers(ctx context.Context, session authn.Session, entityID string, roleID string) error { + ret := _m.Called(ctx, session, entityID, roleID) if len(ret) == 0 { panic("no return value specified for RoleRemoveAllMembers") @@ -613,7 +613,7 @@ func (_m *Service) RoleRemoveAllMembers(ctx context.Context, session authn.Sessi var r0 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) error); ok { - r0 = rf(ctx, session, entityID, roleName) + r0 = rf(ctx, session, entityID, roleID) } else { r0 = ret.Error(0) } @@ -621,9 +621,9 @@ func (_m *Service) RoleRemoveAllMembers(ctx context.Context, session authn.Sessi return r0 } -// RoleRemoveMembers provides a mock function with given fields: ctx, session, entityID, roleName, members -func (_m *Service) RoleRemoveMembers(ctx context.Context, session authn.Session, entityID string, roleName string, members []string) error { - ret := _m.Called(ctx, session, entityID, roleName, members) +// RoleRemoveMembers provides a mock function with given fields: ctx, session, entityID, roleID, members +func (_m *Service) RoleRemoveMembers(ctx context.Context, session authn.Session, entityID string, roleID string, members []string) error { + ret := _m.Called(ctx, session, entityID, roleID, members) if len(ret) == 0 { panic("no return value specified for RoleRemoveMembers") @@ -631,7 +631,7 @@ func (_m *Service) RoleRemoveMembers(ctx context.Context, session authn.Session, var r0 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) error); ok { - r0 = rf(ctx, session, entityID, roleName, members) + r0 = rf(ctx, session, entityID, roleID, members) } else { r0 = ret.Error(0) } @@ -713,9 +713,9 @@ func (_m *Service) UpdateChannelTags(ctx context.Context, session authn.Session, return r0, r1 } -// UpdateRoleName provides a mock function with given fields: ctx, session, entityID, oldRoleName, newRoleName -func (_m *Service) UpdateRoleName(ctx context.Context, session authn.Session, entityID string, oldRoleName string, newRoleName string) (roles.Role, error) { - ret := _m.Called(ctx, session, entityID, oldRoleName, newRoleName) +// UpdateRoleName provides a mock function with given fields: ctx, session, entityID, roleID, newRoleName +func (_m *Service) UpdateRoleName(ctx context.Context, session authn.Session, entityID string, roleID string, newRoleName string) (roles.Role, error) { + ret := _m.Called(ctx, session, entityID, roleID, newRoleName) if len(ret) == 0 { panic("no return value specified for UpdateRoleName") @@ -724,16 +724,16 @@ func (_m *Service) UpdateRoleName(ctx context.Context, session authn.Session, en var r0 roles.Role var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, string) (roles.Role, error)); ok { - return rf(ctx, session, entityID, oldRoleName, newRoleName) + return rf(ctx, session, entityID, roleID, newRoleName) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, string) roles.Role); ok { - r0 = rf(ctx, session, entityID, oldRoleName, newRoleName) + r0 = rf(ctx, session, entityID, roleID, newRoleName) } else { r0 = ret.Get(0).(roles.Role) } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, string) error); ok { - r1 = rf(ctx, session, entityID, oldRoleName, newRoleName) + r1 = rf(ctx, session, entityID, roleID, newRoleName) } else { r1 = ret.Error(1) } diff --git a/clients/mocks/repository.go b/clients/mocks/repository.go index 22f57e651d..501a9e9807 100644 --- a/clients/mocks/repository.go +++ b/clients/mocks/repository.go @@ -491,6 +491,34 @@ func (_m *Repository) RetrieveEntitiesRolesActionsMembers(ctx context.Context, e return r0, r1, r2 } +// RetrieveEntityRole provides a mock function with given fields: ctx, entityID, roleID +func (_m *Repository) RetrieveEntityRole(ctx context.Context, entityID string, roleID string) (roles.Role, error) { + ret := _m.Called(ctx, entityID, roleID) + + if len(ret) == 0 { + panic("no return value specified for RetrieveEntityRole") + } + + var r0 roles.Role + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, string) (roles.Role, error)); ok { + return rf(ctx, entityID, roleID) + } + if rf, ok := ret.Get(0).(func(context.Context, string, string) roles.Role); ok { + r0 = rf(ctx, entityID, roleID) + } else { + r0 = ret.Get(0).(roles.Role) + } + + if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { + r1 = rf(ctx, entityID, roleID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // RetrieveParentGroupClients provides a mock function with given fields: ctx, parentGroupID func (_m *Repository) RetrieveParentGroupClients(ctx context.Context, parentGroupID string) ([]clients.Client, error) { ret := _m.Called(ctx, parentGroupID) @@ -549,34 +577,6 @@ func (_m *Repository) RetrieveRole(ctx context.Context, roleID string) (roles.Ro return r0, r1 } -// RetrieveRoleByEntityIDAndName provides a mock function with given fields: ctx, entityID, roleName -func (_m *Repository) RetrieveRoleByEntityIDAndName(ctx context.Context, entityID string, roleName string) (roles.Role, error) { - ret := _m.Called(ctx, entityID, roleName) - - if len(ret) == 0 { - panic("no return value specified for RetrieveRoleByEntityIDAndName") - } - - var r0 roles.Role - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, string) (roles.Role, error)); ok { - return rf(ctx, entityID, roleName) - } - if rf, ok := ret.Get(0).(func(context.Context, string, string) roles.Role); ok { - r0 = rf(ctx, entityID, roleName) - } else { - r0 = ret.Get(0).(roles.Role) - } - - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(ctx, entityID, roleName) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - // RoleAddActions provides a mock function with given fields: ctx, role, actions func (_m *Repository) RoleAddActions(ctx context.Context, role roles.Role, actions []string) ([]string, error) { ret := _m.Called(ctx, role, actions) diff --git a/clients/mocks/service.go b/clients/mocks/service.go index 595af58fff..f93aac6425 100644 --- a/clients/mocks/service.go +++ b/clients/mocks/service.go @@ -253,9 +253,9 @@ func (_m *Service) RemoveParentGroup(ctx context.Context, session authn.Session, return r0 } -// RemoveRole provides a mock function with given fields: ctx, session, entityID, roleName -func (_m *Service) RemoveRole(ctx context.Context, session authn.Session, entityID string, roleName string) error { - ret := _m.Called(ctx, session, entityID, roleName) +// RemoveRole provides a mock function with given fields: ctx, session, entityID, roleID +func (_m *Service) RemoveRole(ctx context.Context, session authn.Session, entityID string, roleID string) error { + ret := _m.Called(ctx, session, entityID, roleID) if len(ret) == 0 { panic("no return value specified for RemoveRole") @@ -263,7 +263,7 @@ func (_m *Service) RemoveRole(ctx context.Context, session authn.Session, entity var r0 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) error); ok { - r0 = rf(ctx, session, entityID, roleName) + r0 = rf(ctx, session, entityID, roleID) } else { r0 = ret.Error(0) } @@ -299,9 +299,9 @@ func (_m *Service) RetrieveAllRoles(ctx context.Context, session authn.Session, return r0, r1 } -// RetrieveRole provides a mock function with given fields: ctx, session, entityID, roleName -func (_m *Service) RetrieveRole(ctx context.Context, session authn.Session, entityID string, roleName string) (roles.Role, error) { - ret := _m.Called(ctx, session, entityID, roleName) +// RetrieveRole provides a mock function with given fields: ctx, session, entityID, roleID +func (_m *Service) RetrieveRole(ctx context.Context, session authn.Session, entityID string, roleID string) (roles.Role, error) { + ret := _m.Called(ctx, session, entityID, roleID) if len(ret) == 0 { panic("no return value specified for RetrieveRole") @@ -310,16 +310,16 @@ func (_m *Service) RetrieveRole(ctx context.Context, session authn.Session, enti var r0 roles.Role var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) (roles.Role, error)); ok { - return rf(ctx, session, entityID, roleName) + return rf(ctx, session, entityID, roleID) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) roles.Role); ok { - r0 = rf(ctx, session, entityID, roleName) + r0 = rf(ctx, session, entityID, roleID) } else { r0 = ret.Get(0).(roles.Role) } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string) error); ok { - r1 = rf(ctx, session, entityID, roleName) + r1 = rf(ctx, session, entityID, roleID) } else { r1 = ret.Error(1) } @@ -327,9 +327,9 @@ func (_m *Service) RetrieveRole(ctx context.Context, session authn.Session, enti return r0, r1 } -// RoleAddActions provides a mock function with given fields: ctx, session, entityID, roleName, actions -func (_m *Service) RoleAddActions(ctx context.Context, session authn.Session, entityID string, roleName string, actions []string) ([]string, error) { - ret := _m.Called(ctx, session, entityID, roleName, actions) +// RoleAddActions provides a mock function with given fields: ctx, session, entityID, roleID, actions +func (_m *Service) RoleAddActions(ctx context.Context, session authn.Session, entityID string, roleID string, actions []string) ([]string, error) { + ret := _m.Called(ctx, session, entityID, roleID, actions) if len(ret) == 0 { panic("no return value specified for RoleAddActions") @@ -338,10 +338,10 @@ func (_m *Service) RoleAddActions(ctx context.Context, session authn.Session, en var r0 []string var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) ([]string, error)); ok { - return rf(ctx, session, entityID, roleName, actions) + return rf(ctx, session, entityID, roleID, actions) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) []string); ok { - r0 = rf(ctx, session, entityID, roleName, actions) + r0 = rf(ctx, session, entityID, roleID, actions) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]string) @@ -349,7 +349,7 @@ func (_m *Service) RoleAddActions(ctx context.Context, session authn.Session, en } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, []string) error); ok { - r1 = rf(ctx, session, entityID, roleName, actions) + r1 = rf(ctx, session, entityID, roleID, actions) } else { r1 = ret.Error(1) } @@ -357,9 +357,9 @@ func (_m *Service) RoleAddActions(ctx context.Context, session authn.Session, en return r0, r1 } -// RoleAddMembers provides a mock function with given fields: ctx, session, entityID, roleName, members -func (_m *Service) RoleAddMembers(ctx context.Context, session authn.Session, entityID string, roleName string, members []string) ([]string, error) { - ret := _m.Called(ctx, session, entityID, roleName, members) +// RoleAddMembers provides a mock function with given fields: ctx, session, entityID, roleID, members +func (_m *Service) RoleAddMembers(ctx context.Context, session authn.Session, entityID string, roleID string, members []string) ([]string, error) { + ret := _m.Called(ctx, session, entityID, roleID, members) if len(ret) == 0 { panic("no return value specified for RoleAddMembers") @@ -368,10 +368,10 @@ func (_m *Service) RoleAddMembers(ctx context.Context, session authn.Session, en var r0 []string var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) ([]string, error)); ok { - return rf(ctx, session, entityID, roleName, members) + return rf(ctx, session, entityID, roleID, members) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) []string); ok { - r0 = rf(ctx, session, entityID, roleName, members) + r0 = rf(ctx, session, entityID, roleID, members) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]string) @@ -379,7 +379,7 @@ func (_m *Service) RoleAddMembers(ctx context.Context, session authn.Session, en } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, []string) error); ok { - r1 = rf(ctx, session, entityID, roleName, members) + r1 = rf(ctx, session, entityID, roleID, members) } else { r1 = ret.Error(1) } @@ -387,9 +387,9 @@ func (_m *Service) RoleAddMembers(ctx context.Context, session authn.Session, en return r0, r1 } -// RoleCheckActionsExists provides a mock function with given fields: ctx, session, entityID, roleName, actions -func (_m *Service) RoleCheckActionsExists(ctx context.Context, session authn.Session, entityID string, roleName string, actions []string) (bool, error) { - ret := _m.Called(ctx, session, entityID, roleName, actions) +// RoleCheckActionsExists provides a mock function with given fields: ctx, session, entityID, roleID, actions +func (_m *Service) RoleCheckActionsExists(ctx context.Context, session authn.Session, entityID string, roleID string, actions []string) (bool, error) { + ret := _m.Called(ctx, session, entityID, roleID, actions) if len(ret) == 0 { panic("no return value specified for RoleCheckActionsExists") @@ -398,16 +398,16 @@ func (_m *Service) RoleCheckActionsExists(ctx context.Context, session authn.Ses var r0 bool var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) (bool, error)); ok { - return rf(ctx, session, entityID, roleName, actions) + return rf(ctx, session, entityID, roleID, actions) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) bool); ok { - r0 = rf(ctx, session, entityID, roleName, actions) + r0 = rf(ctx, session, entityID, roleID, actions) } else { r0 = ret.Get(0).(bool) } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, []string) error); ok { - r1 = rf(ctx, session, entityID, roleName, actions) + r1 = rf(ctx, session, entityID, roleID, actions) } else { r1 = ret.Error(1) } @@ -415,9 +415,9 @@ func (_m *Service) RoleCheckActionsExists(ctx context.Context, session authn.Ses return r0, r1 } -// RoleCheckMembersExists provides a mock function with given fields: ctx, session, entityID, roleName, members -func (_m *Service) RoleCheckMembersExists(ctx context.Context, session authn.Session, entityID string, roleName string, members []string) (bool, error) { - ret := _m.Called(ctx, session, entityID, roleName, members) +// RoleCheckMembersExists provides a mock function with given fields: ctx, session, entityID, roleID, members +func (_m *Service) RoleCheckMembersExists(ctx context.Context, session authn.Session, entityID string, roleID string, members []string) (bool, error) { + ret := _m.Called(ctx, session, entityID, roleID, members) if len(ret) == 0 { panic("no return value specified for RoleCheckMembersExists") @@ -426,16 +426,16 @@ func (_m *Service) RoleCheckMembersExists(ctx context.Context, session authn.Ses var r0 bool var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) (bool, error)); ok { - return rf(ctx, session, entityID, roleName, members) + return rf(ctx, session, entityID, roleID, members) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) bool); ok { - r0 = rf(ctx, session, entityID, roleName, members) + r0 = rf(ctx, session, entityID, roleID, members) } else { r0 = ret.Get(0).(bool) } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, []string) error); ok { - r1 = rf(ctx, session, entityID, roleName, members) + r1 = rf(ctx, session, entityID, roleID, members) } else { r1 = ret.Error(1) } @@ -443,9 +443,9 @@ func (_m *Service) RoleCheckMembersExists(ctx context.Context, session authn.Ses return r0, r1 } -// RoleListActions provides a mock function with given fields: ctx, session, entityID, roleName -func (_m *Service) RoleListActions(ctx context.Context, session authn.Session, entityID string, roleName string) ([]string, error) { - ret := _m.Called(ctx, session, entityID, roleName) +// RoleListActions provides a mock function with given fields: ctx, session, entityID, roleID +func (_m *Service) RoleListActions(ctx context.Context, session authn.Session, entityID string, roleID string) ([]string, error) { + ret := _m.Called(ctx, session, entityID, roleID) if len(ret) == 0 { panic("no return value specified for RoleListActions") @@ -454,10 +454,10 @@ func (_m *Service) RoleListActions(ctx context.Context, session authn.Session, e var r0 []string var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) ([]string, error)); ok { - return rf(ctx, session, entityID, roleName) + return rf(ctx, session, entityID, roleID) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) []string); ok { - r0 = rf(ctx, session, entityID, roleName) + r0 = rf(ctx, session, entityID, roleID) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]string) @@ -465,7 +465,7 @@ func (_m *Service) RoleListActions(ctx context.Context, session authn.Session, e } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string) error); ok { - r1 = rf(ctx, session, entityID, roleName) + r1 = rf(ctx, session, entityID, roleID) } else { r1 = ret.Error(1) } @@ -473,9 +473,9 @@ func (_m *Service) RoleListActions(ctx context.Context, session authn.Session, e return r0, r1 } -// RoleListMembers provides a mock function with given fields: ctx, session, entityID, roleName, limit, offset -func (_m *Service) RoleListMembers(ctx context.Context, session authn.Session, entityID string, roleName string, limit uint64, offset uint64) (roles.MembersPage, error) { - ret := _m.Called(ctx, session, entityID, roleName, limit, offset) +// RoleListMembers provides a mock function with given fields: ctx, session, entityID, roleID, limit, offset +func (_m *Service) RoleListMembers(ctx context.Context, session authn.Session, entityID string, roleID string, limit uint64, offset uint64) (roles.MembersPage, error) { + ret := _m.Called(ctx, session, entityID, roleID, limit, offset) if len(ret) == 0 { panic("no return value specified for RoleListMembers") @@ -484,16 +484,16 @@ func (_m *Service) RoleListMembers(ctx context.Context, session authn.Session, e var r0 roles.MembersPage var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, uint64, uint64) (roles.MembersPage, error)); ok { - return rf(ctx, session, entityID, roleName, limit, offset) + return rf(ctx, session, entityID, roleID, limit, offset) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, uint64, uint64) roles.MembersPage); ok { - r0 = rf(ctx, session, entityID, roleName, limit, offset) + r0 = rf(ctx, session, entityID, roleID, limit, offset) } else { r0 = ret.Get(0).(roles.MembersPage) } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, uint64, uint64) error); ok { - r1 = rf(ctx, session, entityID, roleName, limit, offset) + r1 = rf(ctx, session, entityID, roleID, limit, offset) } else { r1 = ret.Error(1) } @@ -501,9 +501,9 @@ func (_m *Service) RoleListMembers(ctx context.Context, session authn.Session, e return r0, r1 } -// RoleRemoveActions provides a mock function with given fields: ctx, session, entityID, roleName, actions -func (_m *Service) RoleRemoveActions(ctx context.Context, session authn.Session, entityID string, roleName string, actions []string) error { - ret := _m.Called(ctx, session, entityID, roleName, actions) +// RoleRemoveActions provides a mock function with given fields: ctx, session, entityID, roleID, actions +func (_m *Service) RoleRemoveActions(ctx context.Context, session authn.Session, entityID string, roleID string, actions []string) error { + ret := _m.Called(ctx, session, entityID, roleID, actions) if len(ret) == 0 { panic("no return value specified for RoleRemoveActions") @@ -511,7 +511,7 @@ func (_m *Service) RoleRemoveActions(ctx context.Context, session authn.Session, var r0 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) error); ok { - r0 = rf(ctx, session, entityID, roleName, actions) + r0 = rf(ctx, session, entityID, roleID, actions) } else { r0 = ret.Error(0) } @@ -519,9 +519,9 @@ func (_m *Service) RoleRemoveActions(ctx context.Context, session authn.Session, return r0 } -// RoleRemoveAllActions provides a mock function with given fields: ctx, session, entityID, roleName -func (_m *Service) RoleRemoveAllActions(ctx context.Context, session authn.Session, entityID string, roleName string) error { - ret := _m.Called(ctx, session, entityID, roleName) +// RoleRemoveAllActions provides a mock function with given fields: ctx, session, entityID, roleID +func (_m *Service) RoleRemoveAllActions(ctx context.Context, session authn.Session, entityID string, roleID string) error { + ret := _m.Called(ctx, session, entityID, roleID) if len(ret) == 0 { panic("no return value specified for RoleRemoveAllActions") @@ -529,7 +529,7 @@ func (_m *Service) RoleRemoveAllActions(ctx context.Context, session authn.Sessi var r0 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) error); ok { - r0 = rf(ctx, session, entityID, roleName) + r0 = rf(ctx, session, entityID, roleID) } else { r0 = ret.Error(0) } @@ -537,9 +537,9 @@ func (_m *Service) RoleRemoveAllActions(ctx context.Context, session authn.Sessi return r0 } -// RoleRemoveAllMembers provides a mock function with given fields: ctx, session, entityID, roleName -func (_m *Service) RoleRemoveAllMembers(ctx context.Context, session authn.Session, entityID string, roleName string) error { - ret := _m.Called(ctx, session, entityID, roleName) +// RoleRemoveAllMembers provides a mock function with given fields: ctx, session, entityID, roleID +func (_m *Service) RoleRemoveAllMembers(ctx context.Context, session authn.Session, entityID string, roleID string) error { + ret := _m.Called(ctx, session, entityID, roleID) if len(ret) == 0 { panic("no return value specified for RoleRemoveAllMembers") @@ -547,7 +547,7 @@ func (_m *Service) RoleRemoveAllMembers(ctx context.Context, session authn.Sessi var r0 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) error); ok { - r0 = rf(ctx, session, entityID, roleName) + r0 = rf(ctx, session, entityID, roleID) } else { r0 = ret.Error(0) } @@ -555,9 +555,9 @@ func (_m *Service) RoleRemoveAllMembers(ctx context.Context, session authn.Sessi return r0 } -// RoleRemoveMembers provides a mock function with given fields: ctx, session, entityID, roleName, members -func (_m *Service) RoleRemoveMembers(ctx context.Context, session authn.Session, entityID string, roleName string, members []string) error { - ret := _m.Called(ctx, session, entityID, roleName, members) +// RoleRemoveMembers provides a mock function with given fields: ctx, session, entityID, roleID, members +func (_m *Service) RoleRemoveMembers(ctx context.Context, session authn.Session, entityID string, roleID string, members []string) error { + ret := _m.Called(ctx, session, entityID, roleID, members) if len(ret) == 0 { panic("no return value specified for RoleRemoveMembers") @@ -565,7 +565,7 @@ func (_m *Service) RoleRemoveMembers(ctx context.Context, session authn.Session, var r0 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) error); ok { - r0 = rf(ctx, session, entityID, roleName, members) + r0 = rf(ctx, session, entityID, roleID, members) } else { r0 = ret.Error(0) } @@ -619,9 +619,9 @@ func (_m *Service) Update(ctx context.Context, session authn.Session, client cli return r0, r1 } -// UpdateRoleName provides a mock function with given fields: ctx, session, entityID, oldRoleName, newRoleName -func (_m *Service) UpdateRoleName(ctx context.Context, session authn.Session, entityID string, oldRoleName string, newRoleName string) (roles.Role, error) { - ret := _m.Called(ctx, session, entityID, oldRoleName, newRoleName) +// UpdateRoleName provides a mock function with given fields: ctx, session, entityID, roleID, newRoleName +func (_m *Service) UpdateRoleName(ctx context.Context, session authn.Session, entityID string, roleID string, newRoleName string) (roles.Role, error) { + ret := _m.Called(ctx, session, entityID, roleID, newRoleName) if len(ret) == 0 { panic("no return value specified for UpdateRoleName") @@ -630,16 +630,16 @@ func (_m *Service) UpdateRoleName(ctx context.Context, session authn.Session, en var r0 roles.Role var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, string) (roles.Role, error)); ok { - return rf(ctx, session, entityID, oldRoleName, newRoleName) + return rf(ctx, session, entityID, roleID, newRoleName) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, string) roles.Role); ok { - r0 = rf(ctx, session, entityID, oldRoleName, newRoleName) + r0 = rf(ctx, session, entityID, roleID, newRoleName) } else { r0 = ret.Get(0).(roles.Role) } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, string) error); ok { - r1 = rf(ctx, session, entityID, oldRoleName, newRoleName) + r1 = rf(ctx, session, entityID, roleID, newRoleName) } else { r1 = ret.Error(1) } diff --git a/domains/mocks/repository.go b/domains/mocks/repository.go index a8dae642f7..8fadf76968 100644 --- a/domains/mocks/repository.go +++ b/domains/mocks/repository.go @@ -281,27 +281,27 @@ func (_m *Repository) RetrieveEntitiesRolesActionsMembers(ctx context.Context, e return r0, r1, r2 } -// RetrieveRole provides a mock function with given fields: ctx, roleID -func (_m *Repository) RetrieveRole(ctx context.Context, roleID string) (roles.Role, error) { - ret := _m.Called(ctx, roleID) +// RetrieveEntityRole provides a mock function with given fields: ctx, entityID, roleID +func (_m *Repository) RetrieveEntityRole(ctx context.Context, entityID string, roleID string) (roles.Role, error) { + ret := _m.Called(ctx, entityID, roleID) if len(ret) == 0 { - panic("no return value specified for RetrieveRole") + panic("no return value specified for RetrieveEntityRole") } var r0 roles.Role var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string) (roles.Role, error)); ok { - return rf(ctx, roleID) + if rf, ok := ret.Get(0).(func(context.Context, string, string) (roles.Role, error)); ok { + return rf(ctx, entityID, roleID) } - if rf, ok := ret.Get(0).(func(context.Context, string) roles.Role); ok { - r0 = rf(ctx, roleID) + if rf, ok := ret.Get(0).(func(context.Context, string, string) roles.Role); ok { + r0 = rf(ctx, entityID, roleID) } else { r0 = ret.Get(0).(roles.Role) } - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(ctx, roleID) + if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { + r1 = rf(ctx, entityID, roleID) } else { r1 = ret.Error(1) } @@ -309,27 +309,27 @@ func (_m *Repository) RetrieveRole(ctx context.Context, roleID string) (roles.Ro return r0, r1 } -// RetrieveRoleByEntityIDAndName provides a mock function with given fields: ctx, entityID, roleName -func (_m *Repository) RetrieveRoleByEntityIDAndName(ctx context.Context, entityID string, roleName string) (roles.Role, error) { - ret := _m.Called(ctx, entityID, roleName) +// RetrieveRole provides a mock function with given fields: ctx, roleID +func (_m *Repository) RetrieveRole(ctx context.Context, roleID string) (roles.Role, error) { + ret := _m.Called(ctx, roleID) if len(ret) == 0 { - panic("no return value specified for RetrieveRoleByEntityIDAndName") + panic("no return value specified for RetrieveRole") } var r0 roles.Role var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, string) (roles.Role, error)); ok { - return rf(ctx, entityID, roleName) + if rf, ok := ret.Get(0).(func(context.Context, string) (roles.Role, error)); ok { + return rf(ctx, roleID) } - if rf, ok := ret.Get(0).(func(context.Context, string, string) roles.Role); ok { - r0 = rf(ctx, entityID, roleName) + if rf, ok := ret.Get(0).(func(context.Context, string) roles.Role); ok { + r0 = rf(ctx, roleID) } else { r0 = ret.Get(0).(roles.Role) } - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(ctx, entityID, roleName) + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, roleID) } else { r1 = ret.Error(1) } diff --git a/domains/mocks/service.go b/domains/mocks/service.go index 4452aa2b16..754d4d5671 100644 --- a/domains/mocks/service.go +++ b/domains/mocks/service.go @@ -255,9 +255,9 @@ func (_m *Service) RemoveMemberFromAllRoles(ctx context.Context, session authn.S return r0 } -// RemoveRole provides a mock function with given fields: ctx, session, entityID, roleName -func (_m *Service) RemoveRole(ctx context.Context, session authn.Session, entityID string, roleName string) error { - ret := _m.Called(ctx, session, entityID, roleName) +// RemoveRole provides a mock function with given fields: ctx, session, entityID, roleID +func (_m *Service) RemoveRole(ctx context.Context, session authn.Session, entityID string, roleID string) error { + ret := _m.Called(ctx, session, entityID, roleID) if len(ret) == 0 { panic("no return value specified for RemoveRole") @@ -265,7 +265,7 @@ func (_m *Service) RemoveRole(ctx context.Context, session authn.Session, entity var r0 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) error); ok { - r0 = rf(ctx, session, entityID, roleName) + r0 = rf(ctx, session, entityID, roleID) } else { r0 = ret.Error(0) } @@ -329,9 +329,9 @@ func (_m *Service) RetrieveDomain(ctx context.Context, sesssion authn.Session, i return r0, r1 } -// RetrieveRole provides a mock function with given fields: ctx, session, entityID, roleName -func (_m *Service) RetrieveRole(ctx context.Context, session authn.Session, entityID string, roleName string) (roles.Role, error) { - ret := _m.Called(ctx, session, entityID, roleName) +// RetrieveRole provides a mock function with given fields: ctx, session, entityID, roleID +func (_m *Service) RetrieveRole(ctx context.Context, session authn.Session, entityID string, roleID string) (roles.Role, error) { + ret := _m.Called(ctx, session, entityID, roleID) if len(ret) == 0 { panic("no return value specified for RetrieveRole") @@ -340,16 +340,16 @@ func (_m *Service) RetrieveRole(ctx context.Context, session authn.Session, enti var r0 roles.Role var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) (roles.Role, error)); ok { - return rf(ctx, session, entityID, roleName) + return rf(ctx, session, entityID, roleID) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) roles.Role); ok { - r0 = rf(ctx, session, entityID, roleName) + r0 = rf(ctx, session, entityID, roleID) } else { r0 = ret.Get(0).(roles.Role) } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string) error); ok { - r1 = rf(ctx, session, entityID, roleName) + r1 = rf(ctx, session, entityID, roleID) } else { r1 = ret.Error(1) } @@ -357,9 +357,9 @@ func (_m *Service) RetrieveRole(ctx context.Context, session authn.Session, enti return r0, r1 } -// RoleAddActions provides a mock function with given fields: ctx, session, entityID, roleName, actions -func (_m *Service) RoleAddActions(ctx context.Context, session authn.Session, entityID string, roleName string, actions []string) ([]string, error) { - ret := _m.Called(ctx, session, entityID, roleName, actions) +// RoleAddActions provides a mock function with given fields: ctx, session, entityID, roleID, actions +func (_m *Service) RoleAddActions(ctx context.Context, session authn.Session, entityID string, roleID string, actions []string) ([]string, error) { + ret := _m.Called(ctx, session, entityID, roleID, actions) if len(ret) == 0 { panic("no return value specified for RoleAddActions") @@ -368,10 +368,10 @@ func (_m *Service) RoleAddActions(ctx context.Context, session authn.Session, en var r0 []string var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) ([]string, error)); ok { - return rf(ctx, session, entityID, roleName, actions) + return rf(ctx, session, entityID, roleID, actions) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) []string); ok { - r0 = rf(ctx, session, entityID, roleName, actions) + r0 = rf(ctx, session, entityID, roleID, actions) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]string) @@ -379,7 +379,7 @@ func (_m *Service) RoleAddActions(ctx context.Context, session authn.Session, en } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, []string) error); ok { - r1 = rf(ctx, session, entityID, roleName, actions) + r1 = rf(ctx, session, entityID, roleID, actions) } else { r1 = ret.Error(1) } @@ -387,9 +387,9 @@ func (_m *Service) RoleAddActions(ctx context.Context, session authn.Session, en return r0, r1 } -// RoleAddMembers provides a mock function with given fields: ctx, session, entityID, roleName, members -func (_m *Service) RoleAddMembers(ctx context.Context, session authn.Session, entityID string, roleName string, members []string) ([]string, error) { - ret := _m.Called(ctx, session, entityID, roleName, members) +// RoleAddMembers provides a mock function with given fields: ctx, session, entityID, roleID, members +func (_m *Service) RoleAddMembers(ctx context.Context, session authn.Session, entityID string, roleID string, members []string) ([]string, error) { + ret := _m.Called(ctx, session, entityID, roleID, members) if len(ret) == 0 { panic("no return value specified for RoleAddMembers") @@ -398,10 +398,10 @@ func (_m *Service) RoleAddMembers(ctx context.Context, session authn.Session, en var r0 []string var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) ([]string, error)); ok { - return rf(ctx, session, entityID, roleName, members) + return rf(ctx, session, entityID, roleID, members) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) []string); ok { - r0 = rf(ctx, session, entityID, roleName, members) + r0 = rf(ctx, session, entityID, roleID, members) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]string) @@ -409,7 +409,7 @@ func (_m *Service) RoleAddMembers(ctx context.Context, session authn.Session, en } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, []string) error); ok { - r1 = rf(ctx, session, entityID, roleName, members) + r1 = rf(ctx, session, entityID, roleID, members) } else { r1 = ret.Error(1) } @@ -417,9 +417,9 @@ func (_m *Service) RoleAddMembers(ctx context.Context, session authn.Session, en return r0, r1 } -// RoleCheckActionsExists provides a mock function with given fields: ctx, session, entityID, roleName, actions -func (_m *Service) RoleCheckActionsExists(ctx context.Context, session authn.Session, entityID string, roleName string, actions []string) (bool, error) { - ret := _m.Called(ctx, session, entityID, roleName, actions) +// RoleCheckActionsExists provides a mock function with given fields: ctx, session, entityID, roleID, actions +func (_m *Service) RoleCheckActionsExists(ctx context.Context, session authn.Session, entityID string, roleID string, actions []string) (bool, error) { + ret := _m.Called(ctx, session, entityID, roleID, actions) if len(ret) == 0 { panic("no return value specified for RoleCheckActionsExists") @@ -428,16 +428,16 @@ func (_m *Service) RoleCheckActionsExists(ctx context.Context, session authn.Ses var r0 bool var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) (bool, error)); ok { - return rf(ctx, session, entityID, roleName, actions) + return rf(ctx, session, entityID, roleID, actions) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) bool); ok { - r0 = rf(ctx, session, entityID, roleName, actions) + r0 = rf(ctx, session, entityID, roleID, actions) } else { r0 = ret.Get(0).(bool) } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, []string) error); ok { - r1 = rf(ctx, session, entityID, roleName, actions) + r1 = rf(ctx, session, entityID, roleID, actions) } else { r1 = ret.Error(1) } @@ -445,9 +445,9 @@ func (_m *Service) RoleCheckActionsExists(ctx context.Context, session authn.Ses return r0, r1 } -// RoleCheckMembersExists provides a mock function with given fields: ctx, session, entityID, roleName, members -func (_m *Service) RoleCheckMembersExists(ctx context.Context, session authn.Session, entityID string, roleName string, members []string) (bool, error) { - ret := _m.Called(ctx, session, entityID, roleName, members) +// RoleCheckMembersExists provides a mock function with given fields: ctx, session, entityID, roleID, members +func (_m *Service) RoleCheckMembersExists(ctx context.Context, session authn.Session, entityID string, roleID string, members []string) (bool, error) { + ret := _m.Called(ctx, session, entityID, roleID, members) if len(ret) == 0 { panic("no return value specified for RoleCheckMembersExists") @@ -456,16 +456,16 @@ func (_m *Service) RoleCheckMembersExists(ctx context.Context, session authn.Ses var r0 bool var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) (bool, error)); ok { - return rf(ctx, session, entityID, roleName, members) + return rf(ctx, session, entityID, roleID, members) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) bool); ok { - r0 = rf(ctx, session, entityID, roleName, members) + r0 = rf(ctx, session, entityID, roleID, members) } else { r0 = ret.Get(0).(bool) } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, []string) error); ok { - r1 = rf(ctx, session, entityID, roleName, members) + r1 = rf(ctx, session, entityID, roleID, members) } else { r1 = ret.Error(1) } @@ -473,9 +473,9 @@ func (_m *Service) RoleCheckMembersExists(ctx context.Context, session authn.Ses return r0, r1 } -// RoleListActions provides a mock function with given fields: ctx, session, entityID, roleName -func (_m *Service) RoleListActions(ctx context.Context, session authn.Session, entityID string, roleName string) ([]string, error) { - ret := _m.Called(ctx, session, entityID, roleName) +// RoleListActions provides a mock function with given fields: ctx, session, entityID, roleID +func (_m *Service) RoleListActions(ctx context.Context, session authn.Session, entityID string, roleID string) ([]string, error) { + ret := _m.Called(ctx, session, entityID, roleID) if len(ret) == 0 { panic("no return value specified for RoleListActions") @@ -484,10 +484,10 @@ func (_m *Service) RoleListActions(ctx context.Context, session authn.Session, e var r0 []string var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) ([]string, error)); ok { - return rf(ctx, session, entityID, roleName) + return rf(ctx, session, entityID, roleID) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) []string); ok { - r0 = rf(ctx, session, entityID, roleName) + r0 = rf(ctx, session, entityID, roleID) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]string) @@ -495,7 +495,7 @@ func (_m *Service) RoleListActions(ctx context.Context, session authn.Session, e } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string) error); ok { - r1 = rf(ctx, session, entityID, roleName) + r1 = rf(ctx, session, entityID, roleID) } else { r1 = ret.Error(1) } @@ -503,9 +503,9 @@ func (_m *Service) RoleListActions(ctx context.Context, session authn.Session, e return r0, r1 } -// RoleListMembers provides a mock function with given fields: ctx, session, entityID, roleName, limit, offset -func (_m *Service) RoleListMembers(ctx context.Context, session authn.Session, entityID string, roleName string, limit uint64, offset uint64) (roles.MembersPage, error) { - ret := _m.Called(ctx, session, entityID, roleName, limit, offset) +// RoleListMembers provides a mock function with given fields: ctx, session, entityID, roleID, limit, offset +func (_m *Service) RoleListMembers(ctx context.Context, session authn.Session, entityID string, roleID string, limit uint64, offset uint64) (roles.MembersPage, error) { + ret := _m.Called(ctx, session, entityID, roleID, limit, offset) if len(ret) == 0 { panic("no return value specified for RoleListMembers") @@ -514,16 +514,16 @@ func (_m *Service) RoleListMembers(ctx context.Context, session authn.Session, e var r0 roles.MembersPage var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, uint64, uint64) (roles.MembersPage, error)); ok { - return rf(ctx, session, entityID, roleName, limit, offset) + return rf(ctx, session, entityID, roleID, limit, offset) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, uint64, uint64) roles.MembersPage); ok { - r0 = rf(ctx, session, entityID, roleName, limit, offset) + r0 = rf(ctx, session, entityID, roleID, limit, offset) } else { r0 = ret.Get(0).(roles.MembersPage) } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, uint64, uint64) error); ok { - r1 = rf(ctx, session, entityID, roleName, limit, offset) + r1 = rf(ctx, session, entityID, roleID, limit, offset) } else { r1 = ret.Error(1) } @@ -531,9 +531,9 @@ func (_m *Service) RoleListMembers(ctx context.Context, session authn.Session, e return r0, r1 } -// RoleRemoveActions provides a mock function with given fields: ctx, session, entityID, roleName, actions -func (_m *Service) RoleRemoveActions(ctx context.Context, session authn.Session, entityID string, roleName string, actions []string) error { - ret := _m.Called(ctx, session, entityID, roleName, actions) +// RoleRemoveActions provides a mock function with given fields: ctx, session, entityID, roleID, actions +func (_m *Service) RoleRemoveActions(ctx context.Context, session authn.Session, entityID string, roleID string, actions []string) error { + ret := _m.Called(ctx, session, entityID, roleID, actions) if len(ret) == 0 { panic("no return value specified for RoleRemoveActions") @@ -541,7 +541,7 @@ func (_m *Service) RoleRemoveActions(ctx context.Context, session authn.Session, var r0 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) error); ok { - r0 = rf(ctx, session, entityID, roleName, actions) + r0 = rf(ctx, session, entityID, roleID, actions) } else { r0 = ret.Error(0) } @@ -549,9 +549,9 @@ func (_m *Service) RoleRemoveActions(ctx context.Context, session authn.Session, return r0 } -// RoleRemoveAllActions provides a mock function with given fields: ctx, session, entityID, roleName -func (_m *Service) RoleRemoveAllActions(ctx context.Context, session authn.Session, entityID string, roleName string) error { - ret := _m.Called(ctx, session, entityID, roleName) +// RoleRemoveAllActions provides a mock function with given fields: ctx, session, entityID, roleID +func (_m *Service) RoleRemoveAllActions(ctx context.Context, session authn.Session, entityID string, roleID string) error { + ret := _m.Called(ctx, session, entityID, roleID) if len(ret) == 0 { panic("no return value specified for RoleRemoveAllActions") @@ -559,7 +559,7 @@ func (_m *Service) RoleRemoveAllActions(ctx context.Context, session authn.Sessi var r0 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) error); ok { - r0 = rf(ctx, session, entityID, roleName) + r0 = rf(ctx, session, entityID, roleID) } else { r0 = ret.Error(0) } @@ -567,9 +567,9 @@ func (_m *Service) RoleRemoveAllActions(ctx context.Context, session authn.Sessi return r0 } -// RoleRemoveAllMembers provides a mock function with given fields: ctx, session, entityID, roleName -func (_m *Service) RoleRemoveAllMembers(ctx context.Context, session authn.Session, entityID string, roleName string) error { - ret := _m.Called(ctx, session, entityID, roleName) +// RoleRemoveAllMembers provides a mock function with given fields: ctx, session, entityID, roleID +func (_m *Service) RoleRemoveAllMembers(ctx context.Context, session authn.Session, entityID string, roleID string) error { + ret := _m.Called(ctx, session, entityID, roleID) if len(ret) == 0 { panic("no return value specified for RoleRemoveAllMembers") @@ -577,7 +577,7 @@ func (_m *Service) RoleRemoveAllMembers(ctx context.Context, session authn.Sessi var r0 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) error); ok { - r0 = rf(ctx, session, entityID, roleName) + r0 = rf(ctx, session, entityID, roleID) } else { r0 = ret.Error(0) } @@ -585,9 +585,9 @@ func (_m *Service) RoleRemoveAllMembers(ctx context.Context, session authn.Sessi return r0 } -// RoleRemoveMembers provides a mock function with given fields: ctx, session, entityID, roleName, members -func (_m *Service) RoleRemoveMembers(ctx context.Context, session authn.Session, entityID string, roleName string, members []string) error { - ret := _m.Called(ctx, session, entityID, roleName, members) +// RoleRemoveMembers provides a mock function with given fields: ctx, session, entityID, roleID, members +func (_m *Service) RoleRemoveMembers(ctx context.Context, session authn.Session, entityID string, roleID string, members []string) error { + ret := _m.Called(ctx, session, entityID, roleID, members) if len(ret) == 0 { panic("no return value specified for RoleRemoveMembers") @@ -595,7 +595,7 @@ func (_m *Service) RoleRemoveMembers(ctx context.Context, session authn.Session, var r0 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) error); ok { - r0 = rf(ctx, session, entityID, roleName, members) + r0 = rf(ctx, session, entityID, roleID, members) } else { r0 = ret.Error(0) } @@ -631,9 +631,9 @@ func (_m *Service) UpdateDomain(ctx context.Context, sesssion authn.Session, id return r0, r1 } -// UpdateRoleName provides a mock function with given fields: ctx, session, entityID, oldRoleName, newRoleName -func (_m *Service) UpdateRoleName(ctx context.Context, session authn.Session, entityID string, oldRoleName string, newRoleName string) (roles.Role, error) { - ret := _m.Called(ctx, session, entityID, oldRoleName, newRoleName) +// UpdateRoleName provides a mock function with given fields: ctx, session, entityID, roleID, newRoleName +func (_m *Service) UpdateRoleName(ctx context.Context, session authn.Session, entityID string, roleID string, newRoleName string) (roles.Role, error) { + ret := _m.Called(ctx, session, entityID, roleID, newRoleName) if len(ret) == 0 { panic("no return value specified for UpdateRoleName") @@ -642,16 +642,16 @@ func (_m *Service) UpdateRoleName(ctx context.Context, session authn.Session, en var r0 roles.Role var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, string) (roles.Role, error)); ok { - return rf(ctx, session, entityID, oldRoleName, newRoleName) + return rf(ctx, session, entityID, roleID, newRoleName) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, string) roles.Role); ok { - r0 = rf(ctx, session, entityID, oldRoleName, newRoleName) + r0 = rf(ctx, session, entityID, roleID, newRoleName) } else { r0 = ret.Get(0).(roles.Role) } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, string) error); ok { - r1 = rf(ctx, session, entityID, oldRoleName, newRoleName) + r1 = rf(ctx, session, entityID, roleID, newRoleName) } else { r1 = ret.Error(1) } diff --git a/groups/mocks/repository.go b/groups/mocks/repository.go index 867680c2ca..c8d9cd6c31 100644 --- a/groups/mocks/repository.go +++ b/groups/mocks/repository.go @@ -383,6 +383,34 @@ func (_m *Repository) RetrieveEntitiesRolesActionsMembers(ctx context.Context, e return r0, r1, r2 } +// RetrieveEntityRole provides a mock function with given fields: ctx, entityID, roleID +func (_m *Repository) RetrieveEntityRole(ctx context.Context, entityID string, roleID string) (roles.Role, error) { + ret := _m.Called(ctx, entityID, roleID) + + if len(ret) == 0 { + panic("no return value specified for RetrieveEntityRole") + } + + var r0 roles.Role + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string, string) (roles.Role, error)); ok { + return rf(ctx, entityID, roleID) + } + if rf, ok := ret.Get(0).(func(context.Context, string, string) roles.Role); ok { + r0 = rf(ctx, entityID, roleID) + } else { + r0 = ret.Get(0).(roles.Role) + } + + if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { + r1 = rf(ctx, entityID, roleID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // RetrieveHierarchy provides a mock function with given fields: ctx, id, hm func (_m *Repository) RetrieveHierarchy(ctx context.Context, id string, hm groups.HierarchyPageMeta) (groups.HierarchyPage, error) { ret := _m.Called(ctx, id, hm) @@ -439,34 +467,6 @@ func (_m *Repository) RetrieveRole(ctx context.Context, roleID string) (roles.Ro return r0, r1 } -// RetrieveRoleByEntityIDAndName provides a mock function with given fields: ctx, entityID, roleName -func (_m *Repository) RetrieveRoleByEntityIDAndName(ctx context.Context, entityID string, roleName string) (roles.Role, error) { - ret := _m.Called(ctx, entityID, roleName) - - if len(ret) == 0 { - panic("no return value specified for RetrieveRoleByEntityIDAndName") - } - - var r0 roles.Role - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, string) (roles.Role, error)); ok { - return rf(ctx, entityID, roleName) - } - if rf, ok := ret.Get(0).(func(context.Context, string, string) roles.Role); ok { - r0 = rf(ctx, entityID, roleName) - } else { - r0 = ret.Get(0).(roles.Role) - } - - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(ctx, entityID, roleName) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - // RetrieveUserGroups provides a mock function with given fields: ctx, domainID, userID, pm func (_m *Repository) RetrieveUserGroups(ctx context.Context, domainID string, userID string, pm groups.PageMeta) (groups.Page, error) { ret := _m.Called(ctx, domainID, userID, pm) diff --git a/groups/mocks/service.go b/groups/mocks/service.go index b45ff45422..6e02c7316b 100644 --- a/groups/mocks/service.go +++ b/groups/mocks/service.go @@ -373,9 +373,9 @@ func (_m *Service) RemoveParentGroup(ctx context.Context, session authn.Session, return r0 } -// RemoveRole provides a mock function with given fields: ctx, session, entityID, roleName -func (_m *Service) RemoveRole(ctx context.Context, session authn.Session, entityID string, roleName string) error { - ret := _m.Called(ctx, session, entityID, roleName) +// RemoveRole provides a mock function with given fields: ctx, session, entityID, roleID +func (_m *Service) RemoveRole(ctx context.Context, session authn.Session, entityID string, roleID string) error { + ret := _m.Called(ctx, session, entityID, roleID) if len(ret) == 0 { panic("no return value specified for RemoveRole") @@ -383,7 +383,7 @@ func (_m *Service) RemoveRole(ctx context.Context, session authn.Session, entity var r0 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) error); ok { - r0 = rf(ctx, session, entityID, roleName) + r0 = rf(ctx, session, entityID, roleID) } else { r0 = ret.Error(0) } @@ -447,9 +447,9 @@ func (_m *Service) RetrieveGroupHierarchy(ctx context.Context, session authn.Ses return r0, r1 } -// RetrieveRole provides a mock function with given fields: ctx, session, entityID, roleName -func (_m *Service) RetrieveRole(ctx context.Context, session authn.Session, entityID string, roleName string) (roles.Role, error) { - ret := _m.Called(ctx, session, entityID, roleName) +// RetrieveRole provides a mock function with given fields: ctx, session, entityID, roleID +func (_m *Service) RetrieveRole(ctx context.Context, session authn.Session, entityID string, roleID string) (roles.Role, error) { + ret := _m.Called(ctx, session, entityID, roleID) if len(ret) == 0 { panic("no return value specified for RetrieveRole") @@ -458,16 +458,16 @@ func (_m *Service) RetrieveRole(ctx context.Context, session authn.Session, enti var r0 roles.Role var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) (roles.Role, error)); ok { - return rf(ctx, session, entityID, roleName) + return rf(ctx, session, entityID, roleID) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) roles.Role); ok { - r0 = rf(ctx, session, entityID, roleName) + r0 = rf(ctx, session, entityID, roleID) } else { r0 = ret.Get(0).(roles.Role) } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string) error); ok { - r1 = rf(ctx, session, entityID, roleName) + r1 = rf(ctx, session, entityID, roleID) } else { r1 = ret.Error(1) } @@ -475,9 +475,9 @@ func (_m *Service) RetrieveRole(ctx context.Context, session authn.Session, enti return r0, r1 } -// RoleAddActions provides a mock function with given fields: ctx, session, entityID, roleName, actions -func (_m *Service) RoleAddActions(ctx context.Context, session authn.Session, entityID string, roleName string, actions []string) ([]string, error) { - ret := _m.Called(ctx, session, entityID, roleName, actions) +// RoleAddActions provides a mock function with given fields: ctx, session, entityID, roleID, actions +func (_m *Service) RoleAddActions(ctx context.Context, session authn.Session, entityID string, roleID string, actions []string) ([]string, error) { + ret := _m.Called(ctx, session, entityID, roleID, actions) if len(ret) == 0 { panic("no return value specified for RoleAddActions") @@ -486,10 +486,10 @@ func (_m *Service) RoleAddActions(ctx context.Context, session authn.Session, en var r0 []string var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) ([]string, error)); ok { - return rf(ctx, session, entityID, roleName, actions) + return rf(ctx, session, entityID, roleID, actions) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) []string); ok { - r0 = rf(ctx, session, entityID, roleName, actions) + r0 = rf(ctx, session, entityID, roleID, actions) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]string) @@ -497,7 +497,7 @@ func (_m *Service) RoleAddActions(ctx context.Context, session authn.Session, en } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, []string) error); ok { - r1 = rf(ctx, session, entityID, roleName, actions) + r1 = rf(ctx, session, entityID, roleID, actions) } else { r1 = ret.Error(1) } @@ -505,9 +505,9 @@ func (_m *Service) RoleAddActions(ctx context.Context, session authn.Session, en return r0, r1 } -// RoleAddMembers provides a mock function with given fields: ctx, session, entityID, roleName, members -func (_m *Service) RoleAddMembers(ctx context.Context, session authn.Session, entityID string, roleName string, members []string) ([]string, error) { - ret := _m.Called(ctx, session, entityID, roleName, members) +// RoleAddMembers provides a mock function with given fields: ctx, session, entityID, roleID, members +func (_m *Service) RoleAddMembers(ctx context.Context, session authn.Session, entityID string, roleID string, members []string) ([]string, error) { + ret := _m.Called(ctx, session, entityID, roleID, members) if len(ret) == 0 { panic("no return value specified for RoleAddMembers") @@ -516,10 +516,10 @@ func (_m *Service) RoleAddMembers(ctx context.Context, session authn.Session, en var r0 []string var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) ([]string, error)); ok { - return rf(ctx, session, entityID, roleName, members) + return rf(ctx, session, entityID, roleID, members) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) []string); ok { - r0 = rf(ctx, session, entityID, roleName, members) + r0 = rf(ctx, session, entityID, roleID, members) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]string) @@ -527,7 +527,7 @@ func (_m *Service) RoleAddMembers(ctx context.Context, session authn.Session, en } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, []string) error); ok { - r1 = rf(ctx, session, entityID, roleName, members) + r1 = rf(ctx, session, entityID, roleID, members) } else { r1 = ret.Error(1) } @@ -535,9 +535,9 @@ func (_m *Service) RoleAddMembers(ctx context.Context, session authn.Session, en return r0, r1 } -// RoleCheckActionsExists provides a mock function with given fields: ctx, session, entityID, roleName, actions -func (_m *Service) RoleCheckActionsExists(ctx context.Context, session authn.Session, entityID string, roleName string, actions []string) (bool, error) { - ret := _m.Called(ctx, session, entityID, roleName, actions) +// RoleCheckActionsExists provides a mock function with given fields: ctx, session, entityID, roleID, actions +func (_m *Service) RoleCheckActionsExists(ctx context.Context, session authn.Session, entityID string, roleID string, actions []string) (bool, error) { + ret := _m.Called(ctx, session, entityID, roleID, actions) if len(ret) == 0 { panic("no return value specified for RoleCheckActionsExists") @@ -546,16 +546,16 @@ func (_m *Service) RoleCheckActionsExists(ctx context.Context, session authn.Ses var r0 bool var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) (bool, error)); ok { - return rf(ctx, session, entityID, roleName, actions) + return rf(ctx, session, entityID, roleID, actions) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) bool); ok { - r0 = rf(ctx, session, entityID, roleName, actions) + r0 = rf(ctx, session, entityID, roleID, actions) } else { r0 = ret.Get(0).(bool) } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, []string) error); ok { - r1 = rf(ctx, session, entityID, roleName, actions) + r1 = rf(ctx, session, entityID, roleID, actions) } else { r1 = ret.Error(1) } @@ -563,9 +563,9 @@ func (_m *Service) RoleCheckActionsExists(ctx context.Context, session authn.Ses return r0, r1 } -// RoleCheckMembersExists provides a mock function with given fields: ctx, session, entityID, roleName, members -func (_m *Service) RoleCheckMembersExists(ctx context.Context, session authn.Session, entityID string, roleName string, members []string) (bool, error) { - ret := _m.Called(ctx, session, entityID, roleName, members) +// RoleCheckMembersExists provides a mock function with given fields: ctx, session, entityID, roleID, members +func (_m *Service) RoleCheckMembersExists(ctx context.Context, session authn.Session, entityID string, roleID string, members []string) (bool, error) { + ret := _m.Called(ctx, session, entityID, roleID, members) if len(ret) == 0 { panic("no return value specified for RoleCheckMembersExists") @@ -574,16 +574,16 @@ func (_m *Service) RoleCheckMembersExists(ctx context.Context, session authn.Ses var r0 bool var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) (bool, error)); ok { - return rf(ctx, session, entityID, roleName, members) + return rf(ctx, session, entityID, roleID, members) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) bool); ok { - r0 = rf(ctx, session, entityID, roleName, members) + r0 = rf(ctx, session, entityID, roleID, members) } else { r0 = ret.Get(0).(bool) } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, []string) error); ok { - r1 = rf(ctx, session, entityID, roleName, members) + r1 = rf(ctx, session, entityID, roleID, members) } else { r1 = ret.Error(1) } @@ -591,9 +591,9 @@ func (_m *Service) RoleCheckMembersExists(ctx context.Context, session authn.Ses return r0, r1 } -// RoleListActions provides a mock function with given fields: ctx, session, entityID, roleName -func (_m *Service) RoleListActions(ctx context.Context, session authn.Session, entityID string, roleName string) ([]string, error) { - ret := _m.Called(ctx, session, entityID, roleName) +// RoleListActions provides a mock function with given fields: ctx, session, entityID, roleID +func (_m *Service) RoleListActions(ctx context.Context, session authn.Session, entityID string, roleID string) ([]string, error) { + ret := _m.Called(ctx, session, entityID, roleID) if len(ret) == 0 { panic("no return value specified for RoleListActions") @@ -602,10 +602,10 @@ func (_m *Service) RoleListActions(ctx context.Context, session authn.Session, e var r0 []string var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) ([]string, error)); ok { - return rf(ctx, session, entityID, roleName) + return rf(ctx, session, entityID, roleID) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) []string); ok { - r0 = rf(ctx, session, entityID, roleName) + r0 = rf(ctx, session, entityID, roleID) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]string) @@ -613,7 +613,7 @@ func (_m *Service) RoleListActions(ctx context.Context, session authn.Session, e } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string) error); ok { - r1 = rf(ctx, session, entityID, roleName) + r1 = rf(ctx, session, entityID, roleID) } else { r1 = ret.Error(1) } @@ -621,9 +621,9 @@ func (_m *Service) RoleListActions(ctx context.Context, session authn.Session, e return r0, r1 } -// RoleListMembers provides a mock function with given fields: ctx, session, entityID, roleName, limit, offset -func (_m *Service) RoleListMembers(ctx context.Context, session authn.Session, entityID string, roleName string, limit uint64, offset uint64) (roles.MembersPage, error) { - ret := _m.Called(ctx, session, entityID, roleName, limit, offset) +// RoleListMembers provides a mock function with given fields: ctx, session, entityID, roleID, limit, offset +func (_m *Service) RoleListMembers(ctx context.Context, session authn.Session, entityID string, roleID string, limit uint64, offset uint64) (roles.MembersPage, error) { + ret := _m.Called(ctx, session, entityID, roleID, limit, offset) if len(ret) == 0 { panic("no return value specified for RoleListMembers") @@ -632,16 +632,16 @@ func (_m *Service) RoleListMembers(ctx context.Context, session authn.Session, e var r0 roles.MembersPage var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, uint64, uint64) (roles.MembersPage, error)); ok { - return rf(ctx, session, entityID, roleName, limit, offset) + return rf(ctx, session, entityID, roleID, limit, offset) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, uint64, uint64) roles.MembersPage); ok { - r0 = rf(ctx, session, entityID, roleName, limit, offset) + r0 = rf(ctx, session, entityID, roleID, limit, offset) } else { r0 = ret.Get(0).(roles.MembersPage) } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, uint64, uint64) error); ok { - r1 = rf(ctx, session, entityID, roleName, limit, offset) + r1 = rf(ctx, session, entityID, roleID, limit, offset) } else { r1 = ret.Error(1) } @@ -649,9 +649,9 @@ func (_m *Service) RoleListMembers(ctx context.Context, session authn.Session, e return r0, r1 } -// RoleRemoveActions provides a mock function with given fields: ctx, session, entityID, roleName, actions -func (_m *Service) RoleRemoveActions(ctx context.Context, session authn.Session, entityID string, roleName string, actions []string) error { - ret := _m.Called(ctx, session, entityID, roleName, actions) +// RoleRemoveActions provides a mock function with given fields: ctx, session, entityID, roleID, actions +func (_m *Service) RoleRemoveActions(ctx context.Context, session authn.Session, entityID string, roleID string, actions []string) error { + ret := _m.Called(ctx, session, entityID, roleID, actions) if len(ret) == 0 { panic("no return value specified for RoleRemoveActions") @@ -659,7 +659,7 @@ func (_m *Service) RoleRemoveActions(ctx context.Context, session authn.Session, var r0 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) error); ok { - r0 = rf(ctx, session, entityID, roleName, actions) + r0 = rf(ctx, session, entityID, roleID, actions) } else { r0 = ret.Error(0) } @@ -667,9 +667,9 @@ func (_m *Service) RoleRemoveActions(ctx context.Context, session authn.Session, return r0 } -// RoleRemoveAllActions provides a mock function with given fields: ctx, session, entityID, roleName -func (_m *Service) RoleRemoveAllActions(ctx context.Context, session authn.Session, entityID string, roleName string) error { - ret := _m.Called(ctx, session, entityID, roleName) +// RoleRemoveAllActions provides a mock function with given fields: ctx, session, entityID, roleID +func (_m *Service) RoleRemoveAllActions(ctx context.Context, session authn.Session, entityID string, roleID string) error { + ret := _m.Called(ctx, session, entityID, roleID) if len(ret) == 0 { panic("no return value specified for RoleRemoveAllActions") @@ -677,7 +677,7 @@ func (_m *Service) RoleRemoveAllActions(ctx context.Context, session authn.Sessi var r0 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) error); ok { - r0 = rf(ctx, session, entityID, roleName) + r0 = rf(ctx, session, entityID, roleID) } else { r0 = ret.Error(0) } @@ -685,9 +685,9 @@ func (_m *Service) RoleRemoveAllActions(ctx context.Context, session authn.Sessi return r0 } -// RoleRemoveAllMembers provides a mock function with given fields: ctx, session, entityID, roleName -func (_m *Service) RoleRemoveAllMembers(ctx context.Context, session authn.Session, entityID string, roleName string) error { - ret := _m.Called(ctx, session, entityID, roleName) +// RoleRemoveAllMembers provides a mock function with given fields: ctx, session, entityID, roleID +func (_m *Service) RoleRemoveAllMembers(ctx context.Context, session authn.Session, entityID string, roleID string) error { + ret := _m.Called(ctx, session, entityID, roleID) if len(ret) == 0 { panic("no return value specified for RoleRemoveAllMembers") @@ -695,7 +695,7 @@ func (_m *Service) RoleRemoveAllMembers(ctx context.Context, session authn.Sessi var r0 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) error); ok { - r0 = rf(ctx, session, entityID, roleName) + r0 = rf(ctx, session, entityID, roleID) } else { r0 = ret.Error(0) } @@ -703,9 +703,9 @@ func (_m *Service) RoleRemoveAllMembers(ctx context.Context, session authn.Sessi return r0 } -// RoleRemoveMembers provides a mock function with given fields: ctx, session, entityID, roleName, members -func (_m *Service) RoleRemoveMembers(ctx context.Context, session authn.Session, entityID string, roleName string, members []string) error { - ret := _m.Called(ctx, session, entityID, roleName, members) +// RoleRemoveMembers provides a mock function with given fields: ctx, session, entityID, roleID, members +func (_m *Service) RoleRemoveMembers(ctx context.Context, session authn.Session, entityID string, roleID string, members []string) error { + ret := _m.Called(ctx, session, entityID, roleID, members) if len(ret) == 0 { panic("no return value specified for RoleRemoveMembers") @@ -713,7 +713,7 @@ func (_m *Service) RoleRemoveMembers(ctx context.Context, session authn.Session, var r0 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) error); ok { - r0 = rf(ctx, session, entityID, roleName, members) + r0 = rf(ctx, session, entityID, roleID, members) } else { r0 = ret.Error(0) } @@ -749,9 +749,9 @@ func (_m *Service) UpdateGroup(ctx context.Context, session authn.Session, g gro return r0, r1 } -// UpdateRoleName provides a mock function with given fields: ctx, session, entityID, oldRoleName, newRoleName -func (_m *Service) UpdateRoleName(ctx context.Context, session authn.Session, entityID string, oldRoleName string, newRoleName string) (roles.Role, error) { - ret := _m.Called(ctx, session, entityID, oldRoleName, newRoleName) +// UpdateRoleName provides a mock function with given fields: ctx, session, entityID, roleID, newRoleName +func (_m *Service) UpdateRoleName(ctx context.Context, session authn.Session, entityID string, roleID string, newRoleName string) (roles.Role, error) { + ret := _m.Called(ctx, session, entityID, roleID, newRoleName) if len(ret) == 0 { panic("no return value specified for UpdateRoleName") @@ -760,16 +760,16 @@ func (_m *Service) UpdateRoleName(ctx context.Context, session authn.Session, en var r0 roles.Role var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, string) (roles.Role, error)); ok { - return rf(ctx, session, entityID, oldRoleName, newRoleName) + return rf(ctx, session, entityID, roleID, newRoleName) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, string) roles.Role); ok { - r0 = rf(ctx, session, entityID, oldRoleName, newRoleName) + r0 = rf(ctx, session, entityID, roleID, newRoleName) } else { r0 = ret.Get(0).(roles.Role) } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, string) error); ok { - r1 = rf(ctx, session, entityID, oldRoleName, newRoleName) + r1 = rf(ctx, session, entityID, roleID, newRoleName) } else { r1 = ret.Error(1) } diff --git a/pkg/roles/mocks/rolemanager.go b/pkg/roles/mocks/rolemanager.go index 636ad5c004..ff16fe9f93 100644 --- a/pkg/roles/mocks/rolemanager.go +++ b/pkg/roles/mocks/rolemanager.go @@ -95,9 +95,9 @@ func (_m *RoleManager) RemoveMemberFromAllRoles(ctx context.Context, session aut return r0 } -// RemoveRole provides a mock function with given fields: ctx, session, entityID, roleName -func (_m *RoleManager) RemoveRole(ctx context.Context, session authn.Session, entityID string, roleName string) error { - ret := _m.Called(ctx, session, entityID, roleName) +// RemoveRole provides a mock function with given fields: ctx, session, entityID, roleID +func (_m *RoleManager) RemoveRole(ctx context.Context, session authn.Session, entityID string, roleID string) error { + ret := _m.Called(ctx, session, entityID, roleID) if len(ret) == 0 { panic("no return value specified for RemoveRole") @@ -105,7 +105,7 @@ func (_m *RoleManager) RemoveRole(ctx context.Context, session authn.Session, en var r0 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) error); ok { - r0 = rf(ctx, session, entityID, roleName) + r0 = rf(ctx, session, entityID, roleID) } else { r0 = ret.Error(0) } @@ -141,9 +141,9 @@ func (_m *RoleManager) RetrieveAllRoles(ctx context.Context, session authn.Sessi return r0, r1 } -// RetrieveRole provides a mock function with given fields: ctx, session, entityID, roleName -func (_m *RoleManager) RetrieveRole(ctx context.Context, session authn.Session, entityID string, roleName string) (roles.Role, error) { - ret := _m.Called(ctx, session, entityID, roleName) +// RetrieveRole provides a mock function with given fields: ctx, session, entityID, roleID +func (_m *RoleManager) RetrieveRole(ctx context.Context, session authn.Session, entityID string, roleID string) (roles.Role, error) { + ret := _m.Called(ctx, session, entityID, roleID) if len(ret) == 0 { panic("no return value specified for RetrieveRole") @@ -152,16 +152,16 @@ func (_m *RoleManager) RetrieveRole(ctx context.Context, session authn.Session, var r0 roles.Role var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) (roles.Role, error)); ok { - return rf(ctx, session, entityID, roleName) + return rf(ctx, session, entityID, roleID) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) roles.Role); ok { - r0 = rf(ctx, session, entityID, roleName) + r0 = rf(ctx, session, entityID, roleID) } else { r0 = ret.Get(0).(roles.Role) } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string) error); ok { - r1 = rf(ctx, session, entityID, roleName) + r1 = rf(ctx, session, entityID, roleID) } else { r1 = ret.Error(1) } @@ -169,9 +169,9 @@ func (_m *RoleManager) RetrieveRole(ctx context.Context, session authn.Session, return r0, r1 } -// RoleAddActions provides a mock function with given fields: ctx, session, entityID, roleName, actions -func (_m *RoleManager) RoleAddActions(ctx context.Context, session authn.Session, entityID string, roleName string, actions []string) ([]string, error) { - ret := _m.Called(ctx, session, entityID, roleName, actions) +// RoleAddActions provides a mock function with given fields: ctx, session, entityID, roleID, actions +func (_m *RoleManager) RoleAddActions(ctx context.Context, session authn.Session, entityID string, roleID string, actions []string) ([]string, error) { + ret := _m.Called(ctx, session, entityID, roleID, actions) if len(ret) == 0 { panic("no return value specified for RoleAddActions") @@ -180,10 +180,10 @@ func (_m *RoleManager) RoleAddActions(ctx context.Context, session authn.Session var r0 []string var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) ([]string, error)); ok { - return rf(ctx, session, entityID, roleName, actions) + return rf(ctx, session, entityID, roleID, actions) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) []string); ok { - r0 = rf(ctx, session, entityID, roleName, actions) + r0 = rf(ctx, session, entityID, roleID, actions) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]string) @@ -191,7 +191,7 @@ func (_m *RoleManager) RoleAddActions(ctx context.Context, session authn.Session } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, []string) error); ok { - r1 = rf(ctx, session, entityID, roleName, actions) + r1 = rf(ctx, session, entityID, roleID, actions) } else { r1 = ret.Error(1) } @@ -199,9 +199,9 @@ func (_m *RoleManager) RoleAddActions(ctx context.Context, session authn.Session return r0, r1 } -// RoleAddMembers provides a mock function with given fields: ctx, session, entityID, roleName, members -func (_m *RoleManager) RoleAddMembers(ctx context.Context, session authn.Session, entityID string, roleName string, members []string) ([]string, error) { - ret := _m.Called(ctx, session, entityID, roleName, members) +// RoleAddMembers provides a mock function with given fields: ctx, session, entityID, roleID, members +func (_m *RoleManager) RoleAddMembers(ctx context.Context, session authn.Session, entityID string, roleID string, members []string) ([]string, error) { + ret := _m.Called(ctx, session, entityID, roleID, members) if len(ret) == 0 { panic("no return value specified for RoleAddMembers") @@ -210,10 +210,10 @@ func (_m *RoleManager) RoleAddMembers(ctx context.Context, session authn.Session var r0 []string var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) ([]string, error)); ok { - return rf(ctx, session, entityID, roleName, members) + return rf(ctx, session, entityID, roleID, members) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) []string); ok { - r0 = rf(ctx, session, entityID, roleName, members) + r0 = rf(ctx, session, entityID, roleID, members) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]string) @@ -221,7 +221,7 @@ func (_m *RoleManager) RoleAddMembers(ctx context.Context, session authn.Session } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, []string) error); ok { - r1 = rf(ctx, session, entityID, roleName, members) + r1 = rf(ctx, session, entityID, roleID, members) } else { r1 = ret.Error(1) } @@ -229,9 +229,9 @@ func (_m *RoleManager) RoleAddMembers(ctx context.Context, session authn.Session return r0, r1 } -// RoleCheckActionsExists provides a mock function with given fields: ctx, session, entityID, roleName, actions -func (_m *RoleManager) RoleCheckActionsExists(ctx context.Context, session authn.Session, entityID string, roleName string, actions []string) (bool, error) { - ret := _m.Called(ctx, session, entityID, roleName, actions) +// RoleCheckActionsExists provides a mock function with given fields: ctx, session, entityID, roleID, actions +func (_m *RoleManager) RoleCheckActionsExists(ctx context.Context, session authn.Session, entityID string, roleID string, actions []string) (bool, error) { + ret := _m.Called(ctx, session, entityID, roleID, actions) if len(ret) == 0 { panic("no return value specified for RoleCheckActionsExists") @@ -240,16 +240,16 @@ func (_m *RoleManager) RoleCheckActionsExists(ctx context.Context, session authn var r0 bool var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) (bool, error)); ok { - return rf(ctx, session, entityID, roleName, actions) + return rf(ctx, session, entityID, roleID, actions) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) bool); ok { - r0 = rf(ctx, session, entityID, roleName, actions) + r0 = rf(ctx, session, entityID, roleID, actions) } else { r0 = ret.Get(0).(bool) } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, []string) error); ok { - r1 = rf(ctx, session, entityID, roleName, actions) + r1 = rf(ctx, session, entityID, roleID, actions) } else { r1 = ret.Error(1) } @@ -257,9 +257,9 @@ func (_m *RoleManager) RoleCheckActionsExists(ctx context.Context, session authn return r0, r1 } -// RoleCheckMembersExists provides a mock function with given fields: ctx, session, entityID, roleName, members -func (_m *RoleManager) RoleCheckMembersExists(ctx context.Context, session authn.Session, entityID string, roleName string, members []string) (bool, error) { - ret := _m.Called(ctx, session, entityID, roleName, members) +// RoleCheckMembersExists provides a mock function with given fields: ctx, session, entityID, roleID, members +func (_m *RoleManager) RoleCheckMembersExists(ctx context.Context, session authn.Session, entityID string, roleID string, members []string) (bool, error) { + ret := _m.Called(ctx, session, entityID, roleID, members) if len(ret) == 0 { panic("no return value specified for RoleCheckMembersExists") @@ -268,16 +268,16 @@ func (_m *RoleManager) RoleCheckMembersExists(ctx context.Context, session authn var r0 bool var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) (bool, error)); ok { - return rf(ctx, session, entityID, roleName, members) + return rf(ctx, session, entityID, roleID, members) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) bool); ok { - r0 = rf(ctx, session, entityID, roleName, members) + r0 = rf(ctx, session, entityID, roleID, members) } else { r0 = ret.Get(0).(bool) } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, []string) error); ok { - r1 = rf(ctx, session, entityID, roleName, members) + r1 = rf(ctx, session, entityID, roleID, members) } else { r1 = ret.Error(1) } @@ -285,9 +285,9 @@ func (_m *RoleManager) RoleCheckMembersExists(ctx context.Context, session authn return r0, r1 } -// RoleListActions provides a mock function with given fields: ctx, session, entityID, roleName -func (_m *RoleManager) RoleListActions(ctx context.Context, session authn.Session, entityID string, roleName string) ([]string, error) { - ret := _m.Called(ctx, session, entityID, roleName) +// RoleListActions provides a mock function with given fields: ctx, session, entityID, roleID +func (_m *RoleManager) RoleListActions(ctx context.Context, session authn.Session, entityID string, roleID string) ([]string, error) { + ret := _m.Called(ctx, session, entityID, roleID) if len(ret) == 0 { panic("no return value specified for RoleListActions") @@ -296,10 +296,10 @@ func (_m *RoleManager) RoleListActions(ctx context.Context, session authn.Sessio var r0 []string var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) ([]string, error)); ok { - return rf(ctx, session, entityID, roleName) + return rf(ctx, session, entityID, roleID) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) []string); ok { - r0 = rf(ctx, session, entityID, roleName) + r0 = rf(ctx, session, entityID, roleID) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]string) @@ -307,7 +307,7 @@ func (_m *RoleManager) RoleListActions(ctx context.Context, session authn.Sessio } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string) error); ok { - r1 = rf(ctx, session, entityID, roleName) + r1 = rf(ctx, session, entityID, roleID) } else { r1 = ret.Error(1) } @@ -315,9 +315,9 @@ func (_m *RoleManager) RoleListActions(ctx context.Context, session authn.Sessio return r0, r1 } -// RoleListMembers provides a mock function with given fields: ctx, session, entityID, roleName, limit, offset -func (_m *RoleManager) RoleListMembers(ctx context.Context, session authn.Session, entityID string, roleName string, limit uint64, offset uint64) (roles.MembersPage, error) { - ret := _m.Called(ctx, session, entityID, roleName, limit, offset) +// RoleListMembers provides a mock function with given fields: ctx, session, entityID, roleID, limit, offset +func (_m *RoleManager) RoleListMembers(ctx context.Context, session authn.Session, entityID string, roleID string, limit uint64, offset uint64) (roles.MembersPage, error) { + ret := _m.Called(ctx, session, entityID, roleID, limit, offset) if len(ret) == 0 { panic("no return value specified for RoleListMembers") @@ -326,16 +326,16 @@ func (_m *RoleManager) RoleListMembers(ctx context.Context, session authn.Sessio var r0 roles.MembersPage var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, uint64, uint64) (roles.MembersPage, error)); ok { - return rf(ctx, session, entityID, roleName, limit, offset) + return rf(ctx, session, entityID, roleID, limit, offset) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, uint64, uint64) roles.MembersPage); ok { - r0 = rf(ctx, session, entityID, roleName, limit, offset) + r0 = rf(ctx, session, entityID, roleID, limit, offset) } else { r0 = ret.Get(0).(roles.MembersPage) } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, uint64, uint64) error); ok { - r1 = rf(ctx, session, entityID, roleName, limit, offset) + r1 = rf(ctx, session, entityID, roleID, limit, offset) } else { r1 = ret.Error(1) } @@ -343,9 +343,9 @@ func (_m *RoleManager) RoleListMembers(ctx context.Context, session authn.Sessio return r0, r1 } -// RoleRemoveActions provides a mock function with given fields: ctx, session, entityID, roleName, actions -func (_m *RoleManager) RoleRemoveActions(ctx context.Context, session authn.Session, entityID string, roleName string, actions []string) error { - ret := _m.Called(ctx, session, entityID, roleName, actions) +// RoleRemoveActions provides a mock function with given fields: ctx, session, entityID, roleID, actions +func (_m *RoleManager) RoleRemoveActions(ctx context.Context, session authn.Session, entityID string, roleID string, actions []string) error { + ret := _m.Called(ctx, session, entityID, roleID, actions) if len(ret) == 0 { panic("no return value specified for RoleRemoveActions") @@ -353,7 +353,7 @@ func (_m *RoleManager) RoleRemoveActions(ctx context.Context, session authn.Sess var r0 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) error); ok { - r0 = rf(ctx, session, entityID, roleName, actions) + r0 = rf(ctx, session, entityID, roleID, actions) } else { r0 = ret.Error(0) } @@ -361,9 +361,9 @@ func (_m *RoleManager) RoleRemoveActions(ctx context.Context, session authn.Sess return r0 } -// RoleRemoveAllActions provides a mock function with given fields: ctx, session, entityID, roleName -func (_m *RoleManager) RoleRemoveAllActions(ctx context.Context, session authn.Session, entityID string, roleName string) error { - ret := _m.Called(ctx, session, entityID, roleName) +// RoleRemoveAllActions provides a mock function with given fields: ctx, session, entityID, roleID +func (_m *RoleManager) RoleRemoveAllActions(ctx context.Context, session authn.Session, entityID string, roleID string) error { + ret := _m.Called(ctx, session, entityID, roleID) if len(ret) == 0 { panic("no return value specified for RoleRemoveAllActions") @@ -371,7 +371,7 @@ func (_m *RoleManager) RoleRemoveAllActions(ctx context.Context, session authn.S var r0 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) error); ok { - r0 = rf(ctx, session, entityID, roleName) + r0 = rf(ctx, session, entityID, roleID) } else { r0 = ret.Error(0) } @@ -379,9 +379,9 @@ func (_m *RoleManager) RoleRemoveAllActions(ctx context.Context, session authn.S return r0 } -// RoleRemoveAllMembers provides a mock function with given fields: ctx, session, entityID, roleName -func (_m *RoleManager) RoleRemoveAllMembers(ctx context.Context, session authn.Session, entityID string, roleName string) error { - ret := _m.Called(ctx, session, entityID, roleName) +// RoleRemoveAllMembers provides a mock function with given fields: ctx, session, entityID, roleID +func (_m *RoleManager) RoleRemoveAllMembers(ctx context.Context, session authn.Session, entityID string, roleID string) error { + ret := _m.Called(ctx, session, entityID, roleID) if len(ret) == 0 { panic("no return value specified for RoleRemoveAllMembers") @@ -389,7 +389,7 @@ func (_m *RoleManager) RoleRemoveAllMembers(ctx context.Context, session authn.S var r0 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string) error); ok { - r0 = rf(ctx, session, entityID, roleName) + r0 = rf(ctx, session, entityID, roleID) } else { r0 = ret.Error(0) } @@ -397,9 +397,9 @@ func (_m *RoleManager) RoleRemoveAllMembers(ctx context.Context, session authn.S return r0 } -// RoleRemoveMembers provides a mock function with given fields: ctx, session, entityID, roleName, members -func (_m *RoleManager) RoleRemoveMembers(ctx context.Context, session authn.Session, entityID string, roleName string, members []string) error { - ret := _m.Called(ctx, session, entityID, roleName, members) +// RoleRemoveMembers provides a mock function with given fields: ctx, session, entityID, roleID, members +func (_m *RoleManager) RoleRemoveMembers(ctx context.Context, session authn.Session, entityID string, roleID string, members []string) error { + ret := _m.Called(ctx, session, entityID, roleID, members) if len(ret) == 0 { panic("no return value specified for RoleRemoveMembers") @@ -407,7 +407,7 @@ func (_m *RoleManager) RoleRemoveMembers(ctx context.Context, session authn.Sess var r0 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, []string) error); ok { - r0 = rf(ctx, session, entityID, roleName, members) + r0 = rf(ctx, session, entityID, roleID, members) } else { r0 = ret.Error(0) } @@ -415,9 +415,9 @@ func (_m *RoleManager) RoleRemoveMembers(ctx context.Context, session authn.Sess return r0 } -// UpdateRoleName provides a mock function with given fields: ctx, session, entityID, oldRoleName, newRoleName -func (_m *RoleManager) UpdateRoleName(ctx context.Context, session authn.Session, entityID string, oldRoleName string, newRoleName string) (roles.Role, error) { - ret := _m.Called(ctx, session, entityID, oldRoleName, newRoleName) +// UpdateRoleName provides a mock function with given fields: ctx, session, entityID, roleID, newRoleName +func (_m *RoleManager) UpdateRoleName(ctx context.Context, session authn.Session, entityID string, roleID string, newRoleName string) (roles.Role, error) { + ret := _m.Called(ctx, session, entityID, roleID, newRoleName) if len(ret) == 0 { panic("no return value specified for UpdateRoleName") @@ -426,16 +426,16 @@ func (_m *RoleManager) UpdateRoleName(ctx context.Context, session authn.Session var r0 roles.Role var r1 error if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, string) (roles.Role, error)); ok { - return rf(ctx, session, entityID, oldRoleName, newRoleName) + return rf(ctx, session, entityID, roleID, newRoleName) } if rf, ok := ret.Get(0).(func(context.Context, authn.Session, string, string, string) roles.Role); ok { - r0 = rf(ctx, session, entityID, oldRoleName, newRoleName) + r0 = rf(ctx, session, entityID, roleID, newRoleName) } else { r0 = ret.Get(0).(roles.Role) } if rf, ok := ret.Get(1).(func(context.Context, authn.Session, string, string, string) error); ok { - r1 = rf(ctx, session, entityID, oldRoleName, newRoleName) + r1 = rf(ctx, session, entityID, roleID, newRoleName) } else { r1 = ret.Error(1) } diff --git a/pkg/roles/mocks/rolesRepo.go b/pkg/roles/mocks/rolesRepo.go index 995c629f20..9679e50d36 100644 --- a/pkg/roles/mocks/rolesRepo.go +++ b/pkg/roles/mocks/rolesRepo.go @@ -149,27 +149,27 @@ func (_m *Repository) RetrieveEntitiesRolesActionsMembers(ctx context.Context, e return r0, r1, r2 } -// RetrieveRole provides a mock function with given fields: ctx, roleID -func (_m *Repository) RetrieveRole(ctx context.Context, roleID string) (roles.Role, error) { - ret := _m.Called(ctx, roleID) +// RetrieveEntityRole provides a mock function with given fields: ctx, entityID, roleID +func (_m *Repository) RetrieveEntityRole(ctx context.Context, entityID string, roleID string) (roles.Role, error) { + ret := _m.Called(ctx, entityID, roleID) if len(ret) == 0 { - panic("no return value specified for RetrieveRole") + panic("no return value specified for RetrieveEntityRole") } var r0 roles.Role var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string) (roles.Role, error)); ok { - return rf(ctx, roleID) + if rf, ok := ret.Get(0).(func(context.Context, string, string) (roles.Role, error)); ok { + return rf(ctx, entityID, roleID) } - if rf, ok := ret.Get(0).(func(context.Context, string) roles.Role); ok { - r0 = rf(ctx, roleID) + if rf, ok := ret.Get(0).(func(context.Context, string, string) roles.Role); ok { + r0 = rf(ctx, entityID, roleID) } else { r0 = ret.Get(0).(roles.Role) } - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(ctx, roleID) + if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { + r1 = rf(ctx, entityID, roleID) } else { r1 = ret.Error(1) } @@ -177,27 +177,27 @@ func (_m *Repository) RetrieveRole(ctx context.Context, roleID string) (roles.Ro return r0, r1 } -// RetrieveRoleByEntityIDAndName provides a mock function with given fields: ctx, entityID, roleName -func (_m *Repository) RetrieveRoleByEntityIDAndName(ctx context.Context, entityID string, roleName string) (roles.Role, error) { - ret := _m.Called(ctx, entityID, roleName) +// RetrieveRole provides a mock function with given fields: ctx, roleID +func (_m *Repository) RetrieveRole(ctx context.Context, roleID string) (roles.Role, error) { + ret := _m.Called(ctx, roleID) if len(ret) == 0 { - panic("no return value specified for RetrieveRoleByEntityIDAndName") + panic("no return value specified for RetrieveRole") } var r0 roles.Role var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, string) (roles.Role, error)); ok { - return rf(ctx, entityID, roleName) + if rf, ok := ret.Get(0).(func(context.Context, string) (roles.Role, error)); ok { + return rf(ctx, roleID) } - if rf, ok := ret.Get(0).(func(context.Context, string, string) roles.Role); ok { - r0 = rf(ctx, entityID, roleName) + if rf, ok := ret.Get(0).(func(context.Context, string) roles.Role); ok { + r0 = rf(ctx, roleID) } else { r0 = ret.Get(0).(roles.Role) } - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(ctx, entityID, roleName) + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, roleID) } else { r1 = ret.Error(1) } diff --git a/pkg/roles/rolemanager/events/events.go b/pkg/roles/rolemanager/events/events.go index 6039810a49..93da93573e 100644 --- a/pkg/roles/rolemanager/events/events.go +++ b/pkg/roles/rolemanager/events/events.go @@ -71,7 +71,6 @@ type removeRoleEvent struct { operationPrefix string entityID string roleID string - roleName string } func (rre removeRoleEvent) Encode() (map[string]interface{}, error) { @@ -79,7 +78,6 @@ func (rre removeRoleEvent) Encode() (map[string]interface{}, error) { "operation": rre.operationPrefix + removeRole, "entity_id": rre.entityID, "role_id": rre.roleID, - "role_name": rre.roleName, } return val, nil } @@ -154,7 +152,6 @@ type roleAddActionsEvent struct { operationPrefix string entityID string roleID string - roleName string actions []string } @@ -163,7 +160,6 @@ func (raae roleAddActionsEvent) Encode() (map[string]interface{}, error) { "operation": raae.operationPrefix + addRoleActions, "entity_id": raae.entityID, "role_id": raae.roleID, - "role_name": raae.roleName, "actions": raae.actions, } return val, nil @@ -173,7 +169,6 @@ type roleListActionsEvent struct { operationPrefix string entityID string roleID string - roleName string } func (rlae roleListActionsEvent) Encode() (map[string]interface{}, error) { @@ -181,7 +176,6 @@ func (rlae roleListActionsEvent) Encode() (map[string]interface{}, error) { "operation": rlae.operationPrefix + listRoleActions, "entity_id": rlae.entityID, "role_id": rlae.roleID, - "role_name": rlae.roleName, } return val, nil } @@ -190,7 +184,6 @@ type roleCheckActionsExistsEvent struct { operationPrefix string entityID string roleID string - roleName string actions []string isAllExists bool } @@ -200,7 +193,6 @@ func (rcaee roleCheckActionsExistsEvent) Encode() (map[string]interface{}, error "operation": rcaee.operationPrefix + checkRoleActions, "entity_id": rcaee.entityID, "role_id": rcaee.roleID, - "role_name": rcaee.roleName, "actions": rcaee.actions, "is_all_exists": rcaee.isAllExists, } @@ -211,7 +203,6 @@ type roleRemoveActionsEvent struct { operationPrefix string entityID string roleID string - roleName string actions []string } @@ -220,7 +211,6 @@ func (rrae roleRemoveActionsEvent) Encode() (map[string]interface{}, error) { "operation": rrae.operationPrefix + removeRoleActions, "entity_id": rrae.entityID, "role_id": rrae.roleID, - "role_name": rrae.roleName, "actions": rrae.actions, } return val, nil @@ -230,7 +220,6 @@ type roleRemoveAllActionsEvent struct { operationPrefix string entityID string roleID string - roleName string } func (rraae roleRemoveAllActionsEvent) Encode() (map[string]interface{}, error) { @@ -238,7 +227,6 @@ func (rraae roleRemoveAllActionsEvent) Encode() (map[string]interface{}, error) "operation": rraae.operationPrefix + removeAllRoleActions, "entity_id": rraae.entityID, "role_id": rraae.roleID, - "role_name": rraae.roleName, } return val, nil } @@ -247,7 +235,6 @@ type roleAddMembersEvent struct { operationPrefix string entityID string roleID string - roleName string members []string } @@ -256,7 +243,6 @@ func (rame roleAddMembersEvent) Encode() (map[string]interface{}, error) { "operation": rame.operationPrefix + addRoleMembers, "entity_id": rame.entityID, "role_id": rame.roleID, - "role_name": rame.roleName, "members": rame.members, } return val, nil @@ -266,7 +252,6 @@ type roleListMembersEvent struct { operationPrefix string entityID string roleID string - roleName string limit uint64 offset uint64 } @@ -276,7 +261,6 @@ func (rlme roleListMembersEvent) Encode() (map[string]interface{}, error) { "operation": rlme.operationPrefix + listRoleMembers, "entity_id": rlme.entityID, "role_id": rlme.roleID, - "role_name": rlme.roleName, "limit": rlme.limit, "offset": rlme.offset, } @@ -287,7 +271,6 @@ type roleCheckMembersExistsEvent struct { operationPrefix string entityID string roleID string - roleName string members []string } @@ -296,7 +279,6 @@ func (rcmee roleCheckMembersExistsEvent) Encode() (map[string]interface{}, error "operation": rcmee.operationPrefix + checkRoleMembers, "entity_id": rcmee.entityID, "role_id": rcmee.roleID, - "role_name": rcmee.roleName, "members": rcmee.members, } return val, nil @@ -306,7 +288,6 @@ type roleRemoveMembersEvent struct { operationPrefix string entityID string roleID string - roleName string members []string } @@ -315,7 +296,6 @@ func (rrme roleRemoveMembersEvent) Encode() (map[string]interface{}, error) { "operation": rrme.operationPrefix + removeRoleMembers, "entity_id": rrme.entityID, "role_id": rrme.roleID, - "role_name": rrme.roleName, "members": rrme.members, } return val, nil @@ -325,7 +305,6 @@ type roleRemoveAllMembersEvent struct { operationPrefix string entityID string roleID string - roleName string } func (rrame roleRemoveAllMembersEvent) Encode() (map[string]interface{}, error) { @@ -333,7 +312,6 @@ func (rrame roleRemoveAllMembersEvent) Encode() (map[string]interface{}, error) "operation": rrame.operationPrefix + removeRoleAllMembers, "entity_id": rrame.entityID, "role_id": rrame.roleID, - "role_name": rrame.roleName, } return val, nil } diff --git a/pkg/roles/rolemanager/events/streams.go b/pkg/roles/rolemanager/events/streams.go index 12e687cdcc..a72a193ead 100644 --- a/pkg/roles/rolemanager/events/streams.go +++ b/pkg/roles/rolemanager/events/streams.go @@ -46,13 +46,13 @@ func (rmes *RoleManagerEventStore) AddRole(ctx context.Context, session authn.Se return ro, nil } -func (rmes *RoleManagerEventStore) RemoveRole(ctx context.Context, session authn.Session, entityID, roleName string) error { - if err := rmes.svc.RemoveRole(ctx, session, entityID, roleName); err != nil { +func (rmes *RoleManagerEventStore) RemoveRole(ctx context.Context, session authn.Session, entityID, roleID string) error { + if err := rmes.svc.RemoveRole(ctx, session, entityID, roleID); err != nil { return err } e := removeRoleEvent{ operationPrefix: rmes.operationPrefix, - roleName: roleName, + roleID: roleID, entityID: entityID, } if err := rmes.Publish(ctx, e); err != nil { @@ -61,8 +61,8 @@ func (rmes *RoleManagerEventStore) RemoveRole(ctx context.Context, session authn return nil } -func (rmes *RoleManagerEventStore) UpdateRoleName(ctx context.Context, session authn.Session, entityID, oldRoleName, newRoleName string) (roles.Role, error) { - ro, err := rmes.svc.UpdateRoleName(ctx, session, entityID, oldRoleName, newRoleName) +func (rmes *RoleManagerEventStore) UpdateRoleName(ctx context.Context, session authn.Session, entityID, roleID, newRoleName string) (roles.Role, error) { + ro, err := rmes.svc.UpdateRoleName(ctx, session, entityID, roleID, newRoleName) if err != nil { return ro, err } @@ -77,8 +77,8 @@ func (rmes *RoleManagerEventStore) UpdateRoleName(ctx context.Context, session a return ro, nil } -func (rmes *RoleManagerEventStore) RetrieveRole(ctx context.Context, session authn.Session, entityID, roleName string) (roles.Role, error) { - ro, err := rmes.svc.RetrieveRole(ctx, session, entityID, roleName) +func (rmes *RoleManagerEventStore) RetrieveRole(ctx context.Context, session authn.Session, entityID, roleID string) (roles.Role, error) { + ro, err := rmes.svc.RetrieveRole(ctx, session, entityID, roleID) if err != nil { return ro, err } @@ -124,15 +124,15 @@ func (rmes *RoleManagerEventStore) ListAvailableActions(ctx context.Context, ses return actions, nil } -func (rmes *RoleManagerEventStore) RoleAddActions(ctx context.Context, session authn.Session, entityID, roleName string, actions []string) ([]string, error) { - actions, err := rmes.svc.RoleAddActions(ctx, session, entityID, roleName, actions) +func (rmes *RoleManagerEventStore) RoleAddActions(ctx context.Context, session authn.Session, entityID, roleID string, actions []string) ([]string, error) { + actions, err := rmes.svc.RoleAddActions(ctx, session, entityID, roleID, actions) if err != nil { return actions, err } e := roleAddActionsEvent{ operationPrefix: rmes.operationPrefix, entityID: entityID, - roleName: roleName, + roleID: roleID, actions: actions, } if err := rmes.Publish(ctx, e); err != nil { @@ -141,8 +141,8 @@ func (rmes *RoleManagerEventStore) RoleAddActions(ctx context.Context, session a return actions, nil } -func (rmes *RoleManagerEventStore) RoleListActions(ctx context.Context, session authn.Session, entityID, roleName string) ([]string, error) { - actions, err := rmes.svc.RoleListActions(ctx, session, entityID, roleName) +func (rmes *RoleManagerEventStore) RoleListActions(ctx context.Context, session authn.Session, entityID, roleID string) ([]string, error) { + actions, err := rmes.svc.RoleListActions(ctx, session, entityID, roleID) if err != nil { return actions, err } @@ -150,7 +150,7 @@ func (rmes *RoleManagerEventStore) RoleListActions(ctx context.Context, session e := roleListActionsEvent{ operationPrefix: rmes.operationPrefix, entityID: entityID, - roleName: roleName, + roleID: roleID, } if err := rmes.Publish(ctx, e); err != nil { return actions, err @@ -158,8 +158,8 @@ func (rmes *RoleManagerEventStore) RoleListActions(ctx context.Context, session return actions, nil } -func (rmes *RoleManagerEventStore) RoleCheckActionsExists(ctx context.Context, session authn.Session, entityID, roleName string, actions []string) (bool, error) { - isAllExists, err := rmes.svc.RoleCheckActionsExists(ctx, session, entityID, roleName, actions) +func (rmes *RoleManagerEventStore) RoleCheckActionsExists(ctx context.Context, session authn.Session, entityID, roleID string, actions []string) (bool, error) { + isAllExists, err := rmes.svc.RoleCheckActionsExists(ctx, session, entityID, roleID, actions) if err != nil { return isAllExists, err } @@ -167,7 +167,7 @@ func (rmes *RoleManagerEventStore) RoleCheckActionsExists(ctx context.Context, s e := roleCheckActionsExistsEvent{ operationPrefix: rmes.operationPrefix, entityID: entityID, - roleName: roleName, + roleID: roleID, actions: actions, isAllExists: isAllExists, } @@ -177,15 +177,15 @@ func (rmes *RoleManagerEventStore) RoleCheckActionsExists(ctx context.Context, s return isAllExists, nil } -func (rmes *RoleManagerEventStore) RoleRemoveActions(ctx context.Context, session authn.Session, entityID, roleName string, actions []string) (err error) { - if err := rmes.svc.RoleRemoveActions(ctx, session, entityID, roleName, actions); err != nil { +func (rmes *RoleManagerEventStore) RoleRemoveActions(ctx context.Context, session authn.Session, entityID, roleID string, actions []string) (err error) { + if err := rmes.svc.RoleRemoveActions(ctx, session, entityID, roleID, actions); err != nil { return err } e := roleRemoveActionsEvent{ operationPrefix: rmes.operationPrefix, entityID: entityID, - roleName: roleName, + roleID: roleID, actions: actions, } if err := rmes.Publish(ctx, e); err != nil { @@ -194,15 +194,15 @@ func (rmes *RoleManagerEventStore) RoleRemoveActions(ctx context.Context, sessio return nil } -func (rmes *RoleManagerEventStore) RoleRemoveAllActions(ctx context.Context, session authn.Session, entityID, roleName string) error { - if err := rmes.svc.RoleRemoveAllActions(ctx, session, entityID, roleName); err != nil { +func (rmes *RoleManagerEventStore) RoleRemoveAllActions(ctx context.Context, session authn.Session, entityID, roleID string) error { + if err := rmes.svc.RoleRemoveAllActions(ctx, session, entityID, roleID); err != nil { return err } e := roleRemoveAllActionsEvent{ operationPrefix: rmes.operationPrefix, entityID: entityID, - roleName: roleName, + roleID: roleID, } if err := rmes.Publish(ctx, e); err != nil { return err @@ -210,8 +210,8 @@ func (rmes *RoleManagerEventStore) RoleRemoveAllActions(ctx context.Context, ses return nil } -func (rmes *RoleManagerEventStore) RoleAddMembers(ctx context.Context, session authn.Session, entityID, roleName string, members []string) ([]string, error) { - mems, err := rmes.svc.RoleAddMembers(ctx, session, entityID, roleName, members) +func (rmes *RoleManagerEventStore) RoleAddMembers(ctx context.Context, session authn.Session, entityID, roleID string, members []string) ([]string, error) { + mems, err := rmes.svc.RoleAddMembers(ctx, session, entityID, roleID, members) if err != nil { return mems, err } @@ -219,7 +219,7 @@ func (rmes *RoleManagerEventStore) RoleAddMembers(ctx context.Context, session a e := roleAddMembersEvent{ operationPrefix: rmes.operationPrefix, entityID: entityID, - roleName: roleName, + roleID: roleID, members: members, } if err := rmes.Publish(ctx, e); err != nil { @@ -228,8 +228,8 @@ func (rmes *RoleManagerEventStore) RoleAddMembers(ctx context.Context, session a return mems, nil } -func (rmes *RoleManagerEventStore) RoleListMembers(ctx context.Context, session authn.Session, entityID, roleName string, limit, offset uint64) (roles.MembersPage, error) { - mp, err := rmes.svc.RoleListMembers(ctx, session, entityID, roleName, limit, offset) +func (rmes *RoleManagerEventStore) RoleListMembers(ctx context.Context, session authn.Session, entityID, roleID string, limit, offset uint64) (roles.MembersPage, error) { + mp, err := rmes.svc.RoleListMembers(ctx, session, entityID, roleID, limit, offset) if err != nil { return mp, err } @@ -237,7 +237,7 @@ func (rmes *RoleManagerEventStore) RoleListMembers(ctx context.Context, session e := roleListMembersEvent{ operationPrefix: rmes.operationPrefix, entityID: entityID, - roleName: roleName, + roleID: roleID, limit: limit, offset: offset, } @@ -247,8 +247,8 @@ func (rmes *RoleManagerEventStore) RoleListMembers(ctx context.Context, session return mp, nil } -func (rmes *RoleManagerEventStore) RoleCheckMembersExists(ctx context.Context, session authn.Session, entityID, roleName string, members []string) (bool, error) { - isAllExists, err := rmes.svc.RoleCheckMembersExists(ctx, session, entityID, roleName, members) +func (rmes *RoleManagerEventStore) RoleCheckMembersExists(ctx context.Context, session authn.Session, entityID, roleID string, members []string) (bool, error) { + isAllExists, err := rmes.svc.RoleCheckMembersExists(ctx, session, entityID, roleID, members) if err != nil { return isAllExists, err } @@ -256,7 +256,7 @@ func (rmes *RoleManagerEventStore) RoleCheckMembersExists(ctx context.Context, s e := roleCheckMembersExistsEvent{ operationPrefix: rmes.operationPrefix, entityID: entityID, - roleName: roleName, + roleID: roleID, members: members, } if err := rmes.Publish(ctx, e); err != nil { @@ -265,15 +265,15 @@ func (rmes *RoleManagerEventStore) RoleCheckMembersExists(ctx context.Context, s return isAllExists, nil } -func (rmes *RoleManagerEventStore) RoleRemoveMembers(ctx context.Context, session authn.Session, entityID, roleName string, members []string) (err error) { - if err := rmes.svc.RoleRemoveMembers(ctx, session, entityID, roleName, members); err != nil { +func (rmes *RoleManagerEventStore) RoleRemoveMembers(ctx context.Context, session authn.Session, entityID, roleID string, members []string) (err error) { + if err := rmes.svc.RoleRemoveMembers(ctx, session, entityID, roleID, members); err != nil { return err } e := roleRemoveMembersEvent{ operationPrefix: rmes.operationPrefix, entityID: entityID, - roleName: roleName, + roleID: roleID, members: members, } if err := rmes.Publish(ctx, e); err != nil { @@ -282,15 +282,15 @@ func (rmes *RoleManagerEventStore) RoleRemoveMembers(ctx context.Context, sessio return nil } -func (rmes *RoleManagerEventStore) RoleRemoveAllMembers(ctx context.Context, session authn.Session, entityID, roleName string) (err error) { - if err := rmes.svc.RoleRemoveAllMembers(ctx, session, entityID, roleName); err != nil { +func (rmes *RoleManagerEventStore) RoleRemoveAllMembers(ctx context.Context, session authn.Session, entityID, roleID string) (err error) { + if err := rmes.svc.RoleRemoveAllMembers(ctx, session, entityID, roleID); err != nil { return err } e := roleRemoveAllMembersEvent{ operationPrefix: rmes.operationPrefix, entityID: entityID, - roleName: roleName, + roleID: roleID, } if err := rmes.Publish(ctx, e); err != nil { return err diff --git a/pkg/roles/rolemanager/middleware/authoirzation.go b/pkg/roles/rolemanager/middleware/authoirzation.go index 893ef6468e..c54235fedc 100644 --- a/pkg/roles/rolemanager/middleware/authoirzation.go +++ b/pkg/roles/rolemanager/middleware/authoirzation.go @@ -66,7 +66,7 @@ func (ram RoleManagerAuthorizationMiddleware) AddRole(ctx context.Context, sessi return ram.svc.AddRole(ctx, session, entityID, roleName, optionalActions, optionalMembers) } -func (ram RoleManagerAuthorizationMiddleware) RemoveRole(ctx context.Context, session authn.Session, entityID, roleName string) error { +func (ram RoleManagerAuthorizationMiddleware) RemoveRole(ctx context.Context, session authn.Session, entityID, roleID string) error { if err := ram.authorize(ctx, roles.OpRemoveRole, smqauthz.PolicyReq{ Domain: session.DomainID, Subject: session.DomainUserID, @@ -77,10 +77,10 @@ func (ram RoleManagerAuthorizationMiddleware) RemoveRole(ctx context.Context, se }); err != nil { return err } - return ram.svc.RemoveRole(ctx, session, entityID, roleName) + return ram.svc.RemoveRole(ctx, session, entityID, roleID) } -func (ram RoleManagerAuthorizationMiddleware) UpdateRoleName(ctx context.Context, session authn.Session, entityID, oldRoleName, newRoleName string) (roles.Role, error) { +func (ram RoleManagerAuthorizationMiddleware) UpdateRoleName(ctx context.Context, session authn.Session, entityID, roleID, newRoleName string) (roles.Role, error) { if err := ram.authorize(ctx, roles.OpUpdateRoleName, smqauthz.PolicyReq{ Domain: session.DomainID, Subject: session.DomainUserID, @@ -91,10 +91,10 @@ func (ram RoleManagerAuthorizationMiddleware) UpdateRoleName(ctx context.Context }); err != nil { return roles.Role{}, err } - return ram.svc.UpdateRoleName(ctx, session, entityID, oldRoleName, newRoleName) + return ram.svc.UpdateRoleName(ctx, session, entityID, roleID, newRoleName) } -func (ram RoleManagerAuthorizationMiddleware) RetrieveRole(ctx context.Context, session authn.Session, entityID, roleName string) (roles.Role, error) { +func (ram RoleManagerAuthorizationMiddleware) RetrieveRole(ctx context.Context, session authn.Session, entityID, roleID string) (roles.Role, error) { if err := ram.authorize(ctx, roles.OpRetrieveRole, smqauthz.PolicyReq{ Domain: session.DomainID, Subject: session.DomainUserID, @@ -105,7 +105,7 @@ func (ram RoleManagerAuthorizationMiddleware) RetrieveRole(ctx context.Context, }); err != nil { return roles.Role{}, err } - return ram.svc.RetrieveRole(ctx, session, entityID, roleName) + return ram.svc.RetrieveRole(ctx, session, entityID, roleID) } func (ram RoleManagerAuthorizationMiddleware) RetrieveAllRoles(ctx context.Context, session authn.Session, entityID string, limit, offset uint64) (roles.RolePage, error) { @@ -126,7 +126,7 @@ func (ram RoleManagerAuthorizationMiddleware) ListAvailableActions(ctx context.C return ram.svc.ListAvailableActions(ctx, session) } -func (ram RoleManagerAuthorizationMiddleware) RoleAddActions(ctx context.Context, session authn.Session, entityID, roleName string, actions []string) (ops []string, err error) { +func (ram RoleManagerAuthorizationMiddleware) RoleAddActions(ctx context.Context, session authn.Session, entityID, roleID string, actions []string) (ops []string, err error) { if err := ram.authorize(ctx, roles.OpRoleAddActions, smqauthz.PolicyReq{ Domain: session.DomainID, Subject: session.DomainUserID, @@ -138,10 +138,10 @@ func (ram RoleManagerAuthorizationMiddleware) RoleAddActions(ctx context.Context return []string{}, err } - return ram.svc.RoleAddActions(ctx, session, entityID, roleName, actions) + return ram.svc.RoleAddActions(ctx, session, entityID, roleID, actions) } -func (ram RoleManagerAuthorizationMiddleware) RoleListActions(ctx context.Context, session authn.Session, entityID, roleName string) ([]string, error) { +func (ram RoleManagerAuthorizationMiddleware) RoleListActions(ctx context.Context, session authn.Session, entityID, roleID string) ([]string, error) { if err := ram.authorize(ctx, roles.OpRoleListActions, smqauthz.PolicyReq{ Domain: session.DomainID, Subject: session.DomainUserID, @@ -153,10 +153,10 @@ func (ram RoleManagerAuthorizationMiddleware) RoleListActions(ctx context.Contex return []string{}, err } - return ram.svc.RoleListActions(ctx, session, entityID, roleName) + return ram.svc.RoleListActions(ctx, session, entityID, roleID) } -func (ram RoleManagerAuthorizationMiddleware) RoleCheckActionsExists(ctx context.Context, session authn.Session, entityID, roleName string, actions []string) (bool, error) { +func (ram RoleManagerAuthorizationMiddleware) RoleCheckActionsExists(ctx context.Context, session authn.Session, entityID, roleID string, actions []string) (bool, error) { if err := ram.authorize(ctx, roles.OpRoleCheckActionsExists, smqauthz.PolicyReq{ Domain: session.DomainID, Subject: session.DomainUserID, @@ -167,10 +167,10 @@ func (ram RoleManagerAuthorizationMiddleware) RoleCheckActionsExists(ctx context }); err != nil { return false, err } - return ram.svc.RoleCheckActionsExists(ctx, session, entityID, roleName, actions) + return ram.svc.RoleCheckActionsExists(ctx, session, entityID, roleID, actions) } -func (ram RoleManagerAuthorizationMiddleware) RoleRemoveActions(ctx context.Context, session authn.Session, entityID, roleName string, actions []string) (err error) { +func (ram RoleManagerAuthorizationMiddleware) RoleRemoveActions(ctx context.Context, session authn.Session, entityID, roleID string, actions []string) (err error) { if err := ram.authorize(ctx, roles.OpRoleRemoveActions, smqauthz.PolicyReq{ Domain: session.DomainID, Subject: session.DomainUserID, @@ -181,10 +181,10 @@ func (ram RoleManagerAuthorizationMiddleware) RoleRemoveActions(ctx context.Cont }); err != nil { return err } - return ram.svc.RoleRemoveActions(ctx, session, entityID, roleName, actions) + return ram.svc.RoleRemoveActions(ctx, session, entityID, roleID, actions) } -func (ram RoleManagerAuthorizationMiddleware) RoleRemoveAllActions(ctx context.Context, session authn.Session, entityID, roleName string) error { +func (ram RoleManagerAuthorizationMiddleware) RoleRemoveAllActions(ctx context.Context, session authn.Session, entityID, roleID string) error { if err := ram.authorize(ctx, roles.OpRoleRemoveAllActions, smqauthz.PolicyReq{ Domain: session.DomainID, Subject: session.DomainUserID, @@ -195,10 +195,10 @@ func (ram RoleManagerAuthorizationMiddleware) RoleRemoveAllActions(ctx context.C }); err != nil { return err } - return ram.svc.RoleRemoveAllActions(ctx, session, entityID, roleName) + return ram.svc.RoleRemoveAllActions(ctx, session, entityID, roleID) } -func (ram RoleManagerAuthorizationMiddleware) RoleAddMembers(ctx context.Context, session authn.Session, entityID, roleName string, members []string) ([]string, error) { +func (ram RoleManagerAuthorizationMiddleware) RoleAddMembers(ctx context.Context, session authn.Session, entityID, roleID string, members []string) ([]string, error) { if err := ram.authorize(ctx, roles.OpRoleAddMembers, smqauthz.PolicyReq{ Domain: session.DomainID, Subject: session.DomainUserID, @@ -209,10 +209,10 @@ func (ram RoleManagerAuthorizationMiddleware) RoleAddMembers(ctx context.Context }); err != nil { return []string{}, err } - return ram.svc.RoleAddMembers(ctx, session, entityID, roleName, members) + return ram.svc.RoleAddMembers(ctx, session, entityID, roleID, members) } -func (ram RoleManagerAuthorizationMiddleware) RoleListMembers(ctx context.Context, session authn.Session, entityID, roleName string, limit, offset uint64) (roles.MembersPage, error) { +func (ram RoleManagerAuthorizationMiddleware) RoleListMembers(ctx context.Context, session authn.Session, entityID, roleID string, limit, offset uint64) (roles.MembersPage, error) { if err := ram.authorize(ctx, roles.OpRoleListMembers, smqauthz.PolicyReq{ Domain: session.DomainID, Subject: session.DomainUserID, @@ -223,10 +223,10 @@ func (ram RoleManagerAuthorizationMiddleware) RoleListMembers(ctx context.Contex }); err != nil { return roles.MembersPage{}, err } - return ram.svc.RoleListMembers(ctx, session, entityID, roleName, limit, offset) + return ram.svc.RoleListMembers(ctx, session, entityID, roleID, limit, offset) } -func (ram RoleManagerAuthorizationMiddleware) RoleCheckMembersExists(ctx context.Context, session authn.Session, entityID, roleName string, members []string) (bool, error) { +func (ram RoleManagerAuthorizationMiddleware) RoleCheckMembersExists(ctx context.Context, session authn.Session, entityID, roleID string, members []string) (bool, error) { if err := ram.authorize(ctx, roles.OpRoleCheckMembersExists, smqauthz.PolicyReq{ Domain: session.DomainID, Subject: session.DomainUserID, @@ -237,10 +237,10 @@ func (ram RoleManagerAuthorizationMiddleware) RoleCheckMembersExists(ctx context }); err != nil { return false, err } - return ram.svc.RoleCheckMembersExists(ctx, session, entityID, roleName, members) + return ram.svc.RoleCheckMembersExists(ctx, session, entityID, roleID, members) } -func (ram RoleManagerAuthorizationMiddleware) RoleRemoveMembers(ctx context.Context, session authn.Session, entityID, roleName string, members []string) (err error) { +func (ram RoleManagerAuthorizationMiddleware) RoleRemoveMembers(ctx context.Context, session authn.Session, entityID, roleID string, members []string) (err error) { if err := ram.authorize(ctx, roles.OpRoleRemoveMembers, smqauthz.PolicyReq{ Domain: session.DomainID, Subject: session.DomainUserID, @@ -251,10 +251,10 @@ func (ram RoleManagerAuthorizationMiddleware) RoleRemoveMembers(ctx context.Cont }); err != nil { return err } - return ram.svc.RoleRemoveMembers(ctx, session, entityID, roleName, members) + return ram.svc.RoleRemoveMembers(ctx, session, entityID, roleID, members) } -func (ram RoleManagerAuthorizationMiddleware) RoleRemoveAllMembers(ctx context.Context, session authn.Session, entityID, roleName string) (err error) { +func (ram RoleManagerAuthorizationMiddleware) RoleRemoveAllMembers(ctx context.Context, session authn.Session, entityID, roleID string) (err error) { if err := ram.authorize(ctx, roles.OpRoleRemoveAllMembers, smqauthz.PolicyReq{ Domain: session.DomainID, Subject: session.DomainUserID, @@ -265,7 +265,7 @@ func (ram RoleManagerAuthorizationMiddleware) RoleRemoveAllMembers(ctx context.C }); err != nil { return err } - return ram.svc.RoleRemoveAllMembers(ctx, session, entityID, roleName) + return ram.svc.RoleRemoveAllMembers(ctx, session, entityID, roleID) } func (ram RoleManagerAuthorizationMiddleware) authorize(ctx context.Context, op svcutil.Operation, pr smqauthz.PolicyReq) error { diff --git a/pkg/roles/rolemanager/middleware/logging.go b/pkg/roles/rolemanager/middleware/logging.go index a5cb9076a8..951e430dad 100644 --- a/pkg/roles/rolemanager/middleware/logging.go +++ b/pkg/roles/rolemanager/middleware/logging.go @@ -53,14 +53,14 @@ func (lm *RoleManagerLoggingMiddleware) AddRole(ctx context.Context, session aut return lm.svc.AddRole(ctx, session, entityID, roleName, optionalActions, optionalMembers) } -func (lm *RoleManagerLoggingMiddleware) RemoveRole(ctx context.Context, session authn.Session, entityID, roleName string) (err error) { +func (lm *RoleManagerLoggingMiddleware) RemoveRole(ctx context.Context, session authn.Session, entityID, roleID string) (err error) { prefix := fmt.Sprintf("Delete %s role", lm.svcName) defer func(begin time.Time) { args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group(lm.svcName+"_delete_role", slog.String("entity_id", entityID), - slog.String("role_name", roleName), + slog.String("role_id", roleID), ), } if err != nil { @@ -70,17 +70,17 @@ func (lm *RoleManagerLoggingMiddleware) RemoveRole(ctx context.Context, session } lm.logger.Info(prefix+" completed successfully", args...) }(time.Now()) - return lm.svc.RemoveRole(ctx, session, entityID, roleName) + return lm.svc.RemoveRole(ctx, session, entityID, roleID) } -func (lm *RoleManagerLoggingMiddleware) UpdateRoleName(ctx context.Context, session authn.Session, entityID, oldRoleName, newRoleName string) (ro roles.Role, err error) { +func (lm *RoleManagerLoggingMiddleware) UpdateRoleName(ctx context.Context, session authn.Session, entityID, roleID, newRoleName string) (ro roles.Role, err error) { prefix := fmt.Sprintf("Update %s role name", lm.svcName) defer func(begin time.Time) { args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group(lm.svcName+"_update_role_name", slog.String("entity_id", entityID), - slog.String("old_role_name", oldRoleName), + slog.String("role_id", roleID), slog.String("new_role_name", newRoleName), ), } @@ -91,17 +91,17 @@ func (lm *RoleManagerLoggingMiddleware) UpdateRoleName(ctx context.Context, sess } lm.logger.Info(prefix+" completed successfully", args...) }(time.Now()) - return lm.svc.UpdateRoleName(ctx, session, entityID, oldRoleName, newRoleName) + return lm.svc.UpdateRoleName(ctx, session, entityID, roleID, newRoleName) } -func (lm *RoleManagerLoggingMiddleware) RetrieveRole(ctx context.Context, session authn.Session, entityID, roleName string) (ro roles.Role, err error) { +func (lm *RoleManagerLoggingMiddleware) RetrieveRole(ctx context.Context, session authn.Session, entityID, roleID string) (ro roles.Role, err error) { prefix := fmt.Sprintf("Retrieve %s role", lm.svcName) defer func(begin time.Time) { args := []any{ slog.String("duration", time.Since(begin).String()), - slog.Group(lm.svcName+"_update_role_name", + slog.Group(lm.svcName+"_retrieve_role", slog.String("entity_id", entityID), - slog.String("role_name", roleName), + slog.String("role_id", roleID), ), } if err != nil { @@ -111,7 +111,7 @@ func (lm *RoleManagerLoggingMiddleware) RetrieveRole(ctx context.Context, sessio } lm.logger.Info(prefix+" completed successfully", args...) }(time.Now()) - return lm.svc.RetrieveRole(ctx, session, entityID, roleName) + return lm.svc.RetrieveRole(ctx, session, entityID, roleID) } func (lm *RoleManagerLoggingMiddleware) RetrieveAllRoles(ctx context.Context, session authn.Session, entityID string, limit, offset uint64) (rp roles.RolePage, err error) { @@ -152,14 +152,14 @@ func (lm *RoleManagerLoggingMiddleware) ListAvailableActions(ctx context.Context return lm.svc.ListAvailableActions(ctx, session) } -func (lm *RoleManagerLoggingMiddleware) RoleAddActions(ctx context.Context, session authn.Session, entityID, roleName string, actions []string) (caps []string, err error) { +func (lm *RoleManagerLoggingMiddleware) RoleAddActions(ctx context.Context, session authn.Session, entityID, roleID string, actions []string) (caps []string, err error) { prefix := fmt.Sprintf("%s role add actions", lm.svcName) defer func(begin time.Time) { args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group(lm.svcName+"_role_add_actions", slog.String("entity_id", entityID), - slog.String("role_name", roleName), + slog.String("role_id", roleID), slog.Any("actions", actions), ), } @@ -170,17 +170,17 @@ func (lm *RoleManagerLoggingMiddleware) RoleAddActions(ctx context.Context, sess } lm.logger.Info(prefix+" completed successfully", args...) }(time.Now()) - return lm.svc.RoleAddActions(ctx, session, entityID, roleName, actions) + return lm.svc.RoleAddActions(ctx, session, entityID, roleID, actions) } -func (lm *RoleManagerLoggingMiddleware) RoleListActions(ctx context.Context, session authn.Session, entityID, roleName string) (roOps []string, err error) { +func (lm *RoleManagerLoggingMiddleware) RoleListActions(ctx context.Context, session authn.Session, entityID, roleID string) (roOps []string, err error) { prefix := fmt.Sprintf("%s role list actions", lm.svcName) defer func(begin time.Time) { args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group(lm.svcName+"_list_role_actions", slog.String("entity_id", entityID), - slog.String("role_name", roleName), + slog.String("role_id", roleID), ), } if err != nil { @@ -190,21 +190,21 @@ func (lm *RoleManagerLoggingMiddleware) RoleListActions(ctx context.Context, ses } lm.logger.Info(prefix+" completed successfully", args...) }(time.Now()) - return lm.svc.RoleListActions(ctx, session, entityID, roleName) + return lm.svc.RoleListActions(ctx, session, entityID, roleID) } -func (lm *RoleManagerLoggingMiddleware) RoleCheckActionsExists(ctx context.Context, session authn.Session, entityID, roleName string, actions []string) (bool, error) { - return lm.svc.RoleCheckActionsExists(ctx, session, entityID, roleName, actions) +func (lm *RoleManagerLoggingMiddleware) RoleCheckActionsExists(ctx context.Context, session authn.Session, entityID, roleID string, actions []string) (bool, error) { + return lm.svc.RoleCheckActionsExists(ctx, session, entityID, roleID, actions) } -func (lm *RoleManagerLoggingMiddleware) RoleRemoveActions(ctx context.Context, session authn.Session, entityID, roleName string, actions []string) (err error) { +func (lm *RoleManagerLoggingMiddleware) RoleRemoveActions(ctx context.Context, session authn.Session, entityID, roleID string, actions []string) (err error) { prefix := fmt.Sprintf("%s role remove actions", lm.svcName) defer func(begin time.Time) { args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group(lm.svcName+"_role_remove_actions", slog.String("entity_id", entityID), - slog.String("role_name", roleName), + slog.String("role_id", roleID), slog.Any("actions", actions), ), } @@ -215,17 +215,17 @@ func (lm *RoleManagerLoggingMiddleware) RoleRemoveActions(ctx context.Context, s } lm.logger.Info(prefix+" completed successfully", args...) }(time.Now()) - return lm.svc.RoleRemoveActions(ctx, session, entityID, roleName, actions) + return lm.svc.RoleRemoveActions(ctx, session, entityID, roleID, actions) } -func (lm *RoleManagerLoggingMiddleware) RoleRemoveAllActions(ctx context.Context, session authn.Session, entityID, roleName string) (err error) { +func (lm *RoleManagerLoggingMiddleware) RoleRemoveAllActions(ctx context.Context, session authn.Session, entityID, roleID string) (err error) { prefix := fmt.Sprintf("%s role remove all actions", lm.svcName) defer func(begin time.Time) { args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group(lm.svcName+"_role_remove_all_actions", slog.String("entity_id", entityID), - slog.String("role_name", roleName), + slog.String("role_id", roleID), ), } if err != nil { @@ -235,17 +235,17 @@ func (lm *RoleManagerLoggingMiddleware) RoleRemoveAllActions(ctx context.Context } lm.logger.Info(prefix+" completed successfully", args...) }(time.Now()) - return lm.svc.RoleRemoveAllActions(ctx, session, entityID, roleName) + return lm.svc.RoleRemoveAllActions(ctx, session, entityID, roleID) } -func (lm *RoleManagerLoggingMiddleware) RoleAddMembers(ctx context.Context, session authn.Session, entityID, roleName string, members []string) (mems []string, err error) { +func (lm *RoleManagerLoggingMiddleware) RoleAddMembers(ctx context.Context, session authn.Session, entityID, roleID string, members []string) (mems []string, err error) { prefix := fmt.Sprintf("%s role add members", lm.svcName) defer func(begin time.Time) { args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group(lm.svcName+"_role_add_members", slog.String("entity_id", entityID), - slog.String("role_name", roleName), + slog.String("role_id", roleID), slog.Any("members", members), ), } @@ -256,17 +256,17 @@ func (lm *RoleManagerLoggingMiddleware) RoleAddMembers(ctx context.Context, sess } lm.logger.Info(prefix+" completed successfully", args...) }(time.Now()) - return lm.svc.RoleAddMembers(ctx, session, entityID, roleName, members) + return lm.svc.RoleAddMembers(ctx, session, entityID, roleID, members) } -func (lm *RoleManagerLoggingMiddleware) RoleListMembers(ctx context.Context, session authn.Session, entityID, roleName string, limit, offset uint64) (mp roles.MembersPage, err error) { +func (lm *RoleManagerLoggingMiddleware) RoleListMembers(ctx context.Context, session authn.Session, entityID, roleID string, limit, offset uint64) (mp roles.MembersPage, err error) { prefix := fmt.Sprintf("%s role list members", lm.svcName) defer func(begin time.Time) { args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group(lm.svcName+"_role_add_members", slog.String("entity_id", entityID), - slog.String("role_name", roleName), + slog.String("role_id", roleID), slog.Uint64("limit", limit), slog.Uint64("offset", offset), ), @@ -278,21 +278,21 @@ func (lm *RoleManagerLoggingMiddleware) RoleListMembers(ctx context.Context, ses } lm.logger.Info(prefix+" completed successfully", args...) }(time.Now()) - return lm.svc.RoleListMembers(ctx, session, entityID, roleName, limit, offset) + return lm.svc.RoleListMembers(ctx, session, entityID, roleID, limit, offset) } -func (lm *RoleManagerLoggingMiddleware) RoleCheckMembersExists(ctx context.Context, session authn.Session, entityID, roleName string, members []string) (bool, error) { - return lm.svc.RoleCheckMembersExists(ctx, session, entityID, roleName, members) +func (lm *RoleManagerLoggingMiddleware) RoleCheckMembersExists(ctx context.Context, session authn.Session, entityID, roleID string, members []string) (bool, error) { + return lm.svc.RoleCheckMembersExists(ctx, session, entityID, roleID, members) } -func (lm *RoleManagerLoggingMiddleware) RoleRemoveMembers(ctx context.Context, session authn.Session, entityID, roleName string, members []string) (err error) { +func (lm *RoleManagerLoggingMiddleware) RoleRemoveMembers(ctx context.Context, session authn.Session, entityID, roleID string, members []string) (err error) { prefix := fmt.Sprintf("%s role remove members", lm.svcName) defer func(begin time.Time) { args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group(lm.svcName+"_role_remove_members", slog.String("entity_id", entityID), - slog.String("role_name", roleName), + slog.String("role_id", roleID), slog.Any("members", members), ), } @@ -303,17 +303,17 @@ func (lm *RoleManagerLoggingMiddleware) RoleRemoveMembers(ctx context.Context, s } lm.logger.Info(prefix+" completed successfully", args...) }(time.Now()) - return lm.svc.RoleRemoveMembers(ctx, session, entityID, roleName, members) + return lm.svc.RoleRemoveMembers(ctx, session, entityID, roleID, members) } -func (lm *RoleManagerLoggingMiddleware) RoleRemoveAllMembers(ctx context.Context, session authn.Session, entityID, roleName string) (err error) { +func (lm *RoleManagerLoggingMiddleware) RoleRemoveAllMembers(ctx context.Context, session authn.Session, entityID, roleID string) (err error) { prefix := fmt.Sprintf("%s role remove all members", lm.svcName) defer func(begin time.Time) { args := []any{ slog.String("duration", time.Since(begin).String()), slog.Group(lm.svcName+"_role_remove_all_members", slog.String("entity_id", entityID), - slog.String("role_name", roleName), + slog.String("role_id", roleID), ), } if err != nil { @@ -323,7 +323,7 @@ func (lm *RoleManagerLoggingMiddleware) RoleRemoveAllMembers(ctx context.Context } lm.logger.Info(prefix+" completed successfully", args...) }(time.Now()) - return lm.svc.RoleRemoveAllMembers(ctx, session, entityID, roleName) + return lm.svc.RoleRemoveAllMembers(ctx, session, entityID, roleID) } func (lm *RoleManagerLoggingMiddleware) RemoveMemberFromAllRoles(ctx context.Context, session authn.Session, memberID string) (err error) { diff --git a/pkg/roles/rolemanager/middleware/meterics.go b/pkg/roles/rolemanager/middleware/meterics.go index 4314920a13..fd8e1f31f1 100644 --- a/pkg/roles/rolemanager/middleware/meterics.go +++ b/pkg/roles/rolemanager/middleware/meterics.go @@ -35,16 +35,16 @@ func (rmm *RoleManagerMetricsMiddleware) AddRole(ctx context.Context, session au return rmm.svc.AddRole(ctx, session, entityID, roleName, optionalActions, optionalMembers) } -func (rmm *RoleManagerMetricsMiddleware) RemoveRole(ctx context.Context, session authn.Session, entityID, roleName string) error { - return rmm.svc.RemoveRole(ctx, session, entityID, roleName) +func (rmm *RoleManagerMetricsMiddleware) RemoveRole(ctx context.Context, session authn.Session, entityID, roleID string) error { + return rmm.svc.RemoveRole(ctx, session, entityID, roleID) } -func (rmm *RoleManagerMetricsMiddleware) UpdateRoleName(ctx context.Context, session authn.Session, entityID, oldRoleName, newRoleName string) (roles.Role, error) { - return rmm.svc.UpdateRoleName(ctx, session, entityID, oldRoleName, newRoleName) +func (rmm *RoleManagerMetricsMiddleware) UpdateRoleName(ctx context.Context, session authn.Session, entityID, roleID, newRoleName string) (roles.Role, error) { + return rmm.svc.UpdateRoleName(ctx, session, entityID, roleID, newRoleName) } -func (rmm *RoleManagerMetricsMiddleware) RetrieveRole(ctx context.Context, session authn.Session, entityID, roleName string) (roles.Role, error) { - return rmm.svc.RetrieveRole(ctx, session, entityID, roleName) +func (rmm *RoleManagerMetricsMiddleware) RetrieveRole(ctx context.Context, session authn.Session, entityID, roleID string) (roles.Role, error) { + return rmm.svc.RetrieveRole(ctx, session, entityID, roleID) } func (rmm *RoleManagerMetricsMiddleware) RetrieveAllRoles(ctx context.Context, session authn.Session, entityID string, limit, offset uint64) (roles.RolePage, error) { @@ -55,44 +55,44 @@ func (rmm *RoleManagerMetricsMiddleware) ListAvailableActions(ctx context.Contex return rmm.svc.ListAvailableActions(ctx, session) } -func (rmm *RoleManagerMetricsMiddleware) RoleAddActions(ctx context.Context, session authn.Session, entityID, roleName string, actions []string) (caps []string, err error) { - return rmm.svc.RoleAddActions(ctx, session, entityID, roleName, actions) +func (rmm *RoleManagerMetricsMiddleware) RoleAddActions(ctx context.Context, session authn.Session, entityID, roleID string, actions []string) (caps []string, err error) { + return rmm.svc.RoleAddActions(ctx, session, entityID, roleID, actions) } -func (rmm *RoleManagerMetricsMiddleware) RoleListActions(ctx context.Context, session authn.Session, entityID, roleName string) ([]string, error) { - return rmm.svc.RoleListActions(ctx, session, entityID, roleName) +func (rmm *RoleManagerMetricsMiddleware) RoleListActions(ctx context.Context, session authn.Session, entityID, roleID string) ([]string, error) { + return rmm.svc.RoleListActions(ctx, session, entityID, roleID) } -func (rmm *RoleManagerMetricsMiddleware) RoleCheckActionsExists(ctx context.Context, session authn.Session, entityID, roleName string, actions []string) (bool, error) { - return rmm.svc.RoleCheckActionsExists(ctx, session, entityID, roleName, actions) +func (rmm *RoleManagerMetricsMiddleware) RoleCheckActionsExists(ctx context.Context, session authn.Session, entityID, roleID string, actions []string) (bool, error) { + return rmm.svc.RoleCheckActionsExists(ctx, session, entityID, roleID, actions) } -func (rmm *RoleManagerMetricsMiddleware) RoleRemoveActions(ctx context.Context, session authn.Session, entityID, roleName string, actions []string) (err error) { - return rmm.svc.RoleRemoveActions(ctx, session, entityID, roleName, actions) +func (rmm *RoleManagerMetricsMiddleware) RoleRemoveActions(ctx context.Context, session authn.Session, entityID, roleID string, actions []string) (err error) { + return rmm.svc.RoleRemoveActions(ctx, session, entityID, roleID, actions) } -func (rmm *RoleManagerMetricsMiddleware) RoleRemoveAllActions(ctx context.Context, session authn.Session, entityID, roleName string) error { - return rmm.svc.RoleRemoveAllActions(ctx, session, entityID, roleName) +func (rmm *RoleManagerMetricsMiddleware) RoleRemoveAllActions(ctx context.Context, session authn.Session, entityID, roleID string) error { + return rmm.svc.RoleRemoveAllActions(ctx, session, entityID, roleID) } -func (rmm *RoleManagerMetricsMiddleware) RoleAddMembers(ctx context.Context, session authn.Session, entityID, roleName string, members []string) ([]string, error) { - return rmm.svc.RoleAddMembers(ctx, session, entityID, roleName, members) +func (rmm *RoleManagerMetricsMiddleware) RoleAddMembers(ctx context.Context, session authn.Session, entityID, roleID string, members []string) ([]string, error) { + return rmm.svc.RoleAddMembers(ctx, session, entityID, roleID, members) } -func (rmm *RoleManagerMetricsMiddleware) RoleListMembers(ctx context.Context, session authn.Session, entityID, roleName string, limit, offset uint64) (roles.MembersPage, error) { - return rmm.svc.RoleListMembers(ctx, session, entityID, roleName, limit, offset) +func (rmm *RoleManagerMetricsMiddleware) RoleListMembers(ctx context.Context, session authn.Session, entityID, roleID string, limit, offset uint64) (roles.MembersPage, error) { + return rmm.svc.RoleListMembers(ctx, session, entityID, roleID, limit, offset) } -func (rmm *RoleManagerMetricsMiddleware) RoleCheckMembersExists(ctx context.Context, session authn.Session, entityID, roleName string, members []string) (bool, error) { - return rmm.svc.RoleCheckMembersExists(ctx, session, entityID, roleName, members) +func (rmm *RoleManagerMetricsMiddleware) RoleCheckMembersExists(ctx context.Context, session authn.Session, entityID, roleID string, members []string) (bool, error) { + return rmm.svc.RoleCheckMembersExists(ctx, session, entityID, roleID, members) } -func (rmm *RoleManagerMetricsMiddleware) RoleRemoveMembers(ctx context.Context, session authn.Session, entityID, roleName string, members []string) (err error) { - return rmm.svc.RoleRemoveMembers(ctx, session, entityID, roleName, members) +func (rmm *RoleManagerMetricsMiddleware) RoleRemoveMembers(ctx context.Context, session authn.Session, entityID, roleID string, members []string) (err error) { + return rmm.svc.RoleRemoveMembers(ctx, session, entityID, roleID, members) } -func (rmm *RoleManagerMetricsMiddleware) RoleRemoveAllMembers(ctx context.Context, session authn.Session, entityID, roleName string) (err error) { - return rmm.svc.RoleRemoveAllMembers(ctx, session, entityID, roleName) +func (rmm *RoleManagerMetricsMiddleware) RoleRemoveAllMembers(ctx context.Context, session authn.Session, entityID, roleID string) (err error) { + return rmm.svc.RoleRemoveAllMembers(ctx, session, entityID, roleID) } func (rmm *RoleManagerMetricsMiddleware) RemoveMemberFromAllRoles(ctx context.Context, session authn.Session, memberID string) (err error) { diff --git a/pkg/roles/rolemanager/tracing/tracing.go b/pkg/roles/rolemanager/tracing/tracing.go index 4a16570919..15b3ce5b10 100644 --- a/pkg/roles/rolemanager/tracing/tracing.go +++ b/pkg/roles/rolemanager/tracing/tracing.go @@ -27,16 +27,16 @@ func (rtm *RoleManagerTracing) AddRole(ctx context.Context, session authn.Sessio return rtm.roles.AddRole(ctx, session, entityID, roleName, optionalActions, optionalMembers) } -func (rtm *RoleManagerTracing) RemoveRole(ctx context.Context, session authn.Session, entityID, roleName string) error { - return rtm.roles.RemoveRole(ctx, session, entityID, roleName) +func (rtm *RoleManagerTracing) RemoveRole(ctx context.Context, session authn.Session, entityID, roleID string) error { + return rtm.roles.RemoveRole(ctx, session, entityID, roleID) } -func (rtm *RoleManagerTracing) UpdateRoleName(ctx context.Context, session authn.Session, entityID, oldRoleName, newRoleName string) (roles.Role, error) { - return rtm.roles.UpdateRoleName(ctx, session, entityID, oldRoleName, newRoleName) +func (rtm *RoleManagerTracing) UpdateRoleName(ctx context.Context, session authn.Session, entityID, roleID, newRoleName string) (roles.Role, error) { + return rtm.roles.UpdateRoleName(ctx, session, entityID, roleID, newRoleName) } -func (rtm *RoleManagerTracing) RetrieveRole(ctx context.Context, session authn.Session, entityID, roleName string) (roles.Role, error) { - return rtm.roles.RetrieveRole(ctx, session, entityID, roleName) +func (rtm *RoleManagerTracing) RetrieveRole(ctx context.Context, session authn.Session, entityID, roleID string) (roles.Role, error) { + return rtm.roles.RetrieveRole(ctx, session, entityID, roleID) } func (rtm *RoleManagerTracing) RetrieveAllRoles(ctx context.Context, session authn.Session, entityID string, limit, offset uint64) (roles.RolePage, error) { @@ -47,44 +47,44 @@ func (rtm *RoleManagerTracing) ListAvailableActions(ctx context.Context, session return rtm.roles.ListAvailableActions(ctx, session) } -func (rtm *RoleManagerTracing) RoleAddActions(ctx context.Context, session authn.Session, entityID, roleName string, actions []string) (ops []string, err error) { - return rtm.roles.RoleAddActions(ctx, session, entityID, roleName, actions) +func (rtm *RoleManagerTracing) RoleAddActions(ctx context.Context, session authn.Session, entityID, roleID string, actions []string) (ops []string, err error) { + return rtm.roles.RoleAddActions(ctx, session, entityID, roleID, actions) } -func (rtm *RoleManagerTracing) RoleListActions(ctx context.Context, session authn.Session, entityID, roleName string) ([]string, error) { - return rtm.roles.RoleListActions(ctx, session, entityID, roleName) +func (rtm *RoleManagerTracing) RoleListActions(ctx context.Context, session authn.Session, entityID, roleID string) ([]string, error) { + return rtm.roles.RoleListActions(ctx, session, entityID, roleID) } -func (rtm *RoleManagerTracing) RoleCheckActionsExists(ctx context.Context, session authn.Session, entityID, roleName string, actions []string) (bool, error) { - return rtm.roles.RoleCheckActionsExists(ctx, session, entityID, roleName, actions) +func (rtm *RoleManagerTracing) RoleCheckActionsExists(ctx context.Context, session authn.Session, entityID, roleID string, actions []string) (bool, error) { + return rtm.roles.RoleCheckActionsExists(ctx, session, entityID, roleID, actions) } -func (rtm *RoleManagerTracing) RoleRemoveActions(ctx context.Context, session authn.Session, entityID, roleName string, actions []string) (err error) { - return rtm.roles.RoleRemoveActions(ctx, session, entityID, roleName, actions) +func (rtm *RoleManagerTracing) RoleRemoveActions(ctx context.Context, session authn.Session, entityID, roleID string, actions []string) (err error) { + return rtm.roles.RoleRemoveActions(ctx, session, entityID, roleID, actions) } -func (rtm *RoleManagerTracing) RoleRemoveAllActions(ctx context.Context, session authn.Session, entityID, roleName string) error { - return rtm.roles.RoleRemoveAllActions(ctx, session, entityID, roleName) +func (rtm *RoleManagerTracing) RoleRemoveAllActions(ctx context.Context, session authn.Session, entityID, roleID string) error { + return rtm.roles.RoleRemoveAllActions(ctx, session, entityID, roleID) } -func (rtm *RoleManagerTracing) RoleAddMembers(ctx context.Context, session authn.Session, entityID, roleName string, members []string) ([]string, error) { - return rtm.roles.RoleAddMembers(ctx, session, entityID, roleName, members) +func (rtm *RoleManagerTracing) RoleAddMembers(ctx context.Context, session authn.Session, entityID, roleID string, members []string) ([]string, error) { + return rtm.roles.RoleAddMembers(ctx, session, entityID, roleID, members) } -func (rtm *RoleManagerTracing) RoleListMembers(ctx context.Context, session authn.Session, entityID, roleName string, limit, offset uint64) (roles.MembersPage, error) { - return rtm.roles.RoleListMembers(ctx, session, entityID, roleName, limit, offset) +func (rtm *RoleManagerTracing) RoleListMembers(ctx context.Context, session authn.Session, entityID, roleID string, limit, offset uint64) (roles.MembersPage, error) { + return rtm.roles.RoleListMembers(ctx, session, entityID, roleID, limit, offset) } -func (rtm *RoleManagerTracing) RoleCheckMembersExists(ctx context.Context, session authn.Session, entityID, roleName string, members []string) (bool, error) { - return rtm.roles.RoleCheckMembersExists(ctx, session, entityID, roleName, members) +func (rtm *RoleManagerTracing) RoleCheckMembersExists(ctx context.Context, session authn.Session, entityID, roleID string, members []string) (bool, error) { + return rtm.roles.RoleCheckMembersExists(ctx, session, entityID, roleID, members) } -func (rtm *RoleManagerTracing) RoleRemoveMembers(ctx context.Context, session authn.Session, entityID, roleName string, members []string) (err error) { - return rtm.roles.RoleRemoveMembers(ctx, session, entityID, roleName, members) +func (rtm *RoleManagerTracing) RoleRemoveMembers(ctx context.Context, session authn.Session, entityID, roleID string, members []string) (err error) { + return rtm.roles.RoleRemoveMembers(ctx, session, entityID, roleID, members) } -func (rtm *RoleManagerTracing) RoleRemoveAllMembers(ctx context.Context, session authn.Session, entityID, roleName string) (err error) { - return rtm.roles.RoleRemoveAllMembers(ctx, session, entityID, roleName) +func (rtm *RoleManagerTracing) RoleRemoveAllMembers(ctx context.Context, session authn.Session, entityID, roleID string) (err error) { + return rtm.roles.RoleRemoveAllMembers(ctx, session, entityID, roleID) } func (rtm *RoleManagerTracing) RemoveMemberFromAllRoles(ctx context.Context, session authn.Session, memberID string) (err error) { diff --git a/pkg/roles/roles.go b/pkg/roles/roles.go index 458fd459ae..347b871e0c 100644 --- a/pkg/roles/roles.go +++ b/pkg/roles/roles.go @@ -93,7 +93,7 @@ type RoleManager interface { AddRole(ctx context.Context, session authn.Session, entityID, roleName string, optionalActions []string, optionalMembers []string) (Role, error) // Remove removes the roles of entity. - RemoveRole(ctx context.Context, session authn.Session, entityID, roleName string) error + RemoveRole(ctx context.Context, session authn.Session, entityID, roleID string) error // UpdateName update the name of the entity role. UpdateRoleName(ctx context.Context, session authn.Session, entityID, roleID, newRoleName string) (Role, error)