示例#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
}