Ejemplo n.º 1
0
Archivo: info.go Proyecto: makyo/juju
func (c *infoCommandBase) apiUsersToUserInfoSlice(users []params.UserInfo) []UserInfo {
	var output []UserInfo
	var now = time.Now()
	for _, info := range users {
		outInfo := UserInfo{
			Username:       info.Username,
			DisplayName:    info.DisplayName,
			Disabled:       info.Disabled,
			LastConnection: common.LastConnection(info.LastConnection, now, c.exactTime),
		}
		if c.exactTime {
			outInfo.DateCreated = info.DateCreated.String()
		} else {
			outInfo.DateCreated = common.UserFriendlyDuration(info.DateCreated, now)
		}

		output = append(output, outInfo)
	}

	return output
}
Ejemplo n.º 2
0
Archivo: info.go Proyecto: bac/juju
func (c *infoCommandBase) apiUsersToUserInfoSlice(users []params.UserInfo) []UserInfo {
	var output []UserInfo
	var now = c.clock.Now()
	for _, info := range users {
		outInfo := UserInfo{
			Username:    info.Username,
			DisplayName: info.DisplayName,
			Access:      info.Access,
			Disabled:    info.Disabled,
		}
		// TODO(wallyworld) record login information about external users.
		if names.NewUserTag(info.Username).IsLocal() {
			outInfo.LastConnection = common.LastConnection(info.LastConnection, now, c.exactTime)
			if c.exactTime {
				outInfo.DateCreated = info.DateCreated.String()
			} else {
				outInfo.DateCreated = common.UserFriendlyDuration(info.DateCreated, now)
			}
		}
		output = append(output, outInfo)
	}

	return output
}