Пример #1
0
Файл: info.go Проект: 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
}
Пример #2
0
Файл: info.go Проект: 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
}