mirror of https://github.com/portainer/portainer
chore(ui/ldap): add texttip for group search configuration (#7944)
parent
459c95169a
commit
9e1f80cf37
|
@ -26,7 +26,7 @@ type Connection interface {
|
||||||
UpdateObject(bucketName string, key []byte, object interface{}) error
|
UpdateObject(bucketName string, key []byte, object interface{}) error
|
||||||
UpdateObjectFunc(bucketName string, key []byte, object any, updateFn func()) error
|
UpdateObjectFunc(bucketName string, key []byte, object any, updateFn func()) error
|
||||||
DeleteObject(bucketName string, key []byte) error
|
DeleteObject(bucketName string, key []byte) error
|
||||||
DeleteAllObjects(bucketName string, matching func(o interface{}) (id int, ok bool)) error
|
DeleteAllObjects(bucketName string, obj interface{}, matching func(o interface{}) (id int, ok bool)) error
|
||||||
GetNextIdentifier(bucketName string) int
|
GetNextIdentifier(bucketName string) int
|
||||||
CreateObject(bucketName string, fn func(uint64) (int, interface{})) error
|
CreateObject(bucketName string, fn func(uint64) (int, interface{})) error
|
||||||
CreateObjectWithId(bucketName string, id int, obj interface{}) error
|
CreateObjectWithId(bucketName string, id int, obj interface{}) error
|
||||||
|
|
|
@ -267,13 +267,12 @@ func (connection *DbConnection) DeleteObject(bucketName string, key []byte) erro
|
||||||
|
|
||||||
// DeleteAllObjects delete all objects where matching() returns (id, ok).
|
// DeleteAllObjects delete all objects where matching() returns (id, ok).
|
||||||
// TODO: think about how to return the error inside (maybe change ok to type err, and use "notfound"?
|
// TODO: think about how to return the error inside (maybe change ok to type err, and use "notfound"?
|
||||||
func (connection *DbConnection) DeleteAllObjects(bucketName string, matching func(o interface{}) (id int, ok bool)) error {
|
func (connection *DbConnection) DeleteAllObjects(bucketName string, obj interface{}, matching func(o interface{}) (id int, ok bool)) error {
|
||||||
return connection.Batch(func(tx *bolt.Tx) error {
|
return connection.Batch(func(tx *bolt.Tx) error {
|
||||||
bucket := tx.Bucket([]byte(bucketName))
|
bucket := tx.Bucket([]byte(bucketName))
|
||||||
|
|
||||||
cursor := bucket.Cursor()
|
cursor := bucket.Cursor()
|
||||||
for k, v := cursor.First(); k != nil; k, v = cursor.Next() {
|
for k, v := cursor.First(); k != nil; k, v = cursor.Next() {
|
||||||
var obj interface{}
|
|
||||||
err := connection.UnmarshalObject(v, &obj)
|
err := connection.UnmarshalObject(v, &obj)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -279,6 +279,7 @@ type (
|
||||||
DeleteTeamMembershipByUserID(userID portainer.UserID) error
|
DeleteTeamMembershipByUserID(userID portainer.UserID) error
|
||||||
DeleteTeamMembershipByTeamID(teamID portainer.TeamID) error
|
DeleteTeamMembershipByTeamID(teamID portainer.TeamID) error
|
||||||
BucketName() string
|
BucketName() string
|
||||||
|
DeleteTeamMembershipByTeamIDAndUserID(teamID portainer.TeamID, userID portainer.UserID) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// TunnelServerService represents a service for managing data associated to the tunnel server
|
// TunnelServerService represents a service for managing data associated to the tunnel server
|
||||||
|
|
|
@ -144,6 +144,7 @@ func (service *Service) DeleteTeamMembership(ID portainer.TeamMembershipID) erro
|
||||||
func (service *Service) DeleteTeamMembershipByUserID(userID portainer.UserID) error {
|
func (service *Service) DeleteTeamMembershipByUserID(userID portainer.UserID) error {
|
||||||
return service.connection.DeleteAllObjects(
|
return service.connection.DeleteAllObjects(
|
||||||
BucketName,
|
BucketName,
|
||||||
|
&portainer.TeamMembership{},
|
||||||
func(obj interface{}) (id int, ok bool) {
|
func(obj interface{}) (id int, ok bool) {
|
||||||
membership, ok := obj.(portainer.TeamMembership)
|
membership, ok := obj.(portainer.TeamMembership)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -164,6 +165,7 @@ func (service *Service) DeleteTeamMembershipByUserID(userID portainer.UserID) er
|
||||||
func (service *Service) DeleteTeamMembershipByTeamID(teamID portainer.TeamID) error {
|
func (service *Service) DeleteTeamMembershipByTeamID(teamID portainer.TeamID) error {
|
||||||
return service.connection.DeleteAllObjects(
|
return service.connection.DeleteAllObjects(
|
||||||
BucketName,
|
BucketName,
|
||||||
|
&portainer.TeamMembership{},
|
||||||
func(obj interface{}) (id int, ok bool) {
|
func(obj interface{}) (id int, ok bool) {
|
||||||
membership, ok := obj.(portainer.TeamMembership)
|
membership, ok := obj.(portainer.TeamMembership)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -179,3 +181,23 @@ func (service *Service) DeleteTeamMembershipByTeamID(teamID portainer.TeamID) er
|
||||||
return -1, false
|
return -1, false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (service *Service) DeleteTeamMembershipByTeamIDAndUserID(teamID portainer.TeamID, userID portainer.UserID) error {
|
||||||
|
return service.connection.DeleteAllObjects(
|
||||||
|
BucketName,
|
||||||
|
&portainer.TeamMembership{},
|
||||||
|
func(obj interface{}) (id int, ok bool) {
|
||||||
|
membership, ok := obj.(portainer.TeamMembership)
|
||||||
|
if !ok {
|
||||||
|
log.Debug().Str("obj", fmt.Sprintf("%#v", obj)).Msg("failed to convert to TeamMembership object")
|
||||||
|
//return fmt.Errorf("Failed to convert to TeamMembership object: %s", obj)
|
||||||
|
return -1, false
|
||||||
|
}
|
||||||
|
|
||||||
|
if membership.TeamID == teamID && membership.UserID == userID {
|
||||||
|
return int(membership.ID), true
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1, false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -35,6 +35,17 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<span class="col-sm-12 small" style="color: #ffa719">
|
||||||
|
<pr-icon icon="'briefcase'" feather="true" class-name="'icon icon-xs vertical-center'"></pr-icon>
|
||||||
|
Users removal synchronize between groups and teams only available in
|
||||||
|
<a href="https://www.portainer.io/features?from=custom-login-banner" target="_blank">business edition.</a>
|
||||||
|
<portainer-tooltip
|
||||||
|
class="text-muted align-bottom"
|
||||||
|
message="'Groups allows users to automatically be added to Portainer teams. However, automatically removing users from teams to keep it fully in sync is available in the Business Edition.'"
|
||||||
|
></portainer-tooltip>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</rd-widget-body>
|
</rd-widget-body>
|
||||||
</rd-widget>
|
</rd-widget>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue