mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: implement cli list organization members (#13555)
example cli command: `coder organization members`
This commit is contained in:
@@ -51,11 +51,11 @@ type Organization struct {
|
||||
}
|
||||
|
||||
type OrganizationMember struct {
|
||||
UserID uuid.UUID `db:"user_id" json:"user_id" format:"uuid"`
|
||||
OrganizationID uuid.UUID `db:"organization_id" json:"organization_id" format:"uuid"`
|
||||
CreatedAt time.Time `db:"created_at" json:"created_at" format:"date-time"`
|
||||
UpdatedAt time.Time `db:"updated_at" json:"updated_at" format:"date-time"`
|
||||
Roles []SlimRole `db:"roles" json:"roles"`
|
||||
UserID uuid.UUID `table:"user id" json:"user_id" format:"uuid"`
|
||||
OrganizationID uuid.UUID `table:"organization id" json:"organization_id" format:"uuid"`
|
||||
CreatedAt time.Time `table:"created at" json:"created_at" format:"date-time"`
|
||||
UpdatedAt time.Time `table:"updated at" json:"updated_at" format:"date-time"`
|
||||
Roles []SlimRole `table:"organization_roles" json:"roles"`
|
||||
}
|
||||
|
||||
type OrganizationMemberWithName struct {
|
||||
|
||||
@@ -19,6 +19,22 @@ type SlimRole struct {
|
||||
OrganizationID string `json:"organization_id,omitempty"`
|
||||
}
|
||||
|
||||
func (s SlimRole) String() string {
|
||||
if s.DisplayName != "" {
|
||||
return s.DisplayName
|
||||
}
|
||||
return s.Name
|
||||
}
|
||||
|
||||
// UniqueName concatenates the organization ID to create a globally unique
|
||||
// string name for the role.
|
||||
func (s SlimRole) UniqueName() string {
|
||||
if s.OrganizationID != "" {
|
||||
return s.Name + ":" + s.OrganizationID
|
||||
}
|
||||
return s.Name
|
||||
}
|
||||
|
||||
type AssignableRoles struct {
|
||||
Role `table:"r,recursive_inline"`
|
||||
Assignable bool `json:"assignable" table:"assignable"`
|
||||
|
||||
Reference in New Issue
Block a user