Skip to content

Commit d3fb80c

Browse files
committed
Added interface
1 parent 0b15564 commit d3fb80c

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

plugin.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ import (
55
"io"
66
"io/fs"
77
"net/http"
8+
"net/url"
89
"time"
910

1011
// Packages
1112
pg "github.com/djthorpe/go-pg"
1213
authschema "github.com/mutablelogic/go-server/pkg/auth/schema"
14+
"github.com/mutablelogic/go-server/pkg/ldap/schema"
1315
pgschema "github.com/mutablelogic/go-server/pkg/pgqueue/schema"
1416
)
1517

@@ -152,3 +154,36 @@ type Auth interface {
152154
// to perform an action.
153155
Authorize(context.Context, *authschema.User, ...string) error
154156
}
157+
158+
///////////////////////////////////////////////////////////////////////////////
159+
// LDAP
160+
161+
type LDAP interface {
162+
// Objects
163+
List(context.Context, schema.ObjectListRequest) (*schema.ObjectList, error) // List all objects in the directory
164+
Get(context.Context, string, ...string) (*schema.Object, error) // Get an object with attributes
165+
Delete(context.Context, string) (*schema.Object, error) // Delete an object
166+
Create(context.Context, string, url.Values) (*schema.Object, error) // Create a new object with attributes
167+
Update(context.Context, string, url.Values) (*schema.Object, error) // Update an object with attributes
168+
169+
// Introspection
170+
ListObjectClasses(context.Context) ([]*schema.ObjectClass, error) // Return all classes
171+
ListAttributeTypes(context.Context) ([]*schema.AttributeType, error) // Return all attributes
172+
173+
// Users
174+
ListUsers(context.Context, schema.ObjectListRequest) ([]*schema.ObjectList, error) // List users
175+
GetUser(context.Context, string, ...string) (*schema.Object, error) // Get a user with attributes
176+
CreateUser(context.Context, string, url.Values) (*schema.Object, error) // Create a user with attributes
177+
DeleteUser(context.Context, string) (*schema.Object, error) // Delete a user
178+
179+
// Groups
180+
ListGroups(context.Context, schema.ObjectListRequest) ([]*schema.ObjectList, error) // List groups
181+
GetGroup(context.Context, string, ...string) (*schema.Object, error) // Get a group with attributes
182+
DeleteGroup(context.Context, string) (*schema.Object, error) // Delete a group
183+
AddGroupUser(context.Context, string, string) (*schema.Object, error) // Add a user to a group
184+
RemoveGroupUser(context.Context, string, string) (*schema.Object, error) // Remove a user from a group
185+
186+
// Auth
187+
Bind(context.Context, string, string) (*schema.Object, error) // Check user and password
188+
ChangePassword(context.Context, string, string, *string) (*schema.Object, error) // Change password for a user, and return the user object
189+
}

0 commit comments

Comments
 (0)