Gno: An interpreted, stack-based Go virtual machine to build succinct and composable apps + gno.land: a blockchain for timeless code and fair open-source.
The UserDirectory is intended to serve as an interface or mechanism for looking up and managing user data within the r/boards realm. This would integrate with the /r/gnoland/users realm, which is responsible for managing user accounts, usernames, and potentially team names. The UserDirectory helps link board operations (like creating, posting, and membership management) with verified user data, facilitating consistency and access control.
Acceptance Criteria:
[ ] Implements the UserDirectory interface with the following core methods:
Lookup(addr Address) User: Retrieves the User object associated with a specific address.
GetUserName(addr Address) string: Returns the display name (username) for the given address.
GetUserRole(addr Address) []string: Provides a list of roles associated with the given address (e.g., Owner, Admin, Moderator).
Example
type UserDirectory interface {
Lookup(addr Address) User
GetUserName(addr Address) string
GetUserRole(addr Address) []string
}
[ ] Integrate UserDirectory with the Board struct to ensure user-related data is accessible for board operations.
Example
```go
type Board struct {
ID int64
Name string
Creator Address
UserDirectory UserDirectory
}
```
[ ] Ensures UserDirectory validates users during board operations to confirm that only recognized users can create boards, post, or manage members.
[ ] UserDirectory can adapt to potential for future integration with external or federated user sources.
[ ] Optimizes user lookup processes to handle frequent queries efficiently and mitigate potential performance bottlenecks.
[ ] Includes error handling for cases where a user address is not found or roles cannot be determined.
[ ] Implements integration tests for user lookups, role checks, and validations within r/boards.
Context:
The
UserDirectory
is intended to serve as an interface or mechanism for looking up and managing user data within ther/boards
realm. This would integrate with the/r/gnoland/users
realm, which is responsible for managing user accounts, usernames, and potentially team names. TheUserDirectory
helps link board operations (like creating, posting, and membership management) with verified user data, facilitating consistency and access control.Acceptance Criteria:
[ ] Implements the
UserDirectory
interface with the following core methods:Lookup(addr Address) User
: Retrieves theUser
object associated with a specific address.GetUserName(addr Address) string
: Returns the display name (username) for the given address.GetUserRole(addr Address) []string
: Provides a list of roles associated with the given address (e.g.,Owner
,Admin
,Moderator
).Example
[ ] Integrate
UserDirectory
with theBoard
struct to ensure user-related data is accessible for board operations.Example
```go type Board struct { ID int64 Name string Creator Address UserDirectory UserDirectory } ```[ ] Ensures
UserDirectory
validates users during board operations to confirm that only recognized users can create boards, post, or manage members.[ ]
UserDirectory
can adapt to potential for future integration with external or federated user sources.[ ] Optimizes user lookup processes to handle frequent queries efficiently and mitigate potential performance bottlenecks.
[ ] Includes error handling for cases where a user address is not found or roles cannot be determined.
[ ] Implements integration tests for user lookups, role checks, and validations within
r/boards
.