Пример #1
0
// PermsList prints which users have permissions.
func PermsList(appID string, admin bool, results int) error {
	c, appID, err := permsLoad(appID, admin)

	if err != nil {
		return err
	}

	var users []string
	var count int

	if admin {
		if results == defaultLimit {
			results = c.ResponseLimit
		}
		users, count, err = perms.ListAdmins(c, results)
	} else {
		users, err = perms.List(c, appID)
	}

	if err != nil {
		return err
	}

	if admin {
		fmt.Printf("=== Administrators%s", limitCount(len(users), count))
	} else {
		fmt.Printf("=== %s's Users\n", appID)
	}

	for _, user := range users {
		fmt.Println(user)
	}

	return nil
}
Пример #2
0
// PermsList prints which users have permissions.
func PermsList(appID string, admin bool) error {
	c, appID, err := permsLoad(appID, admin)

	if err != nil {
		return err
	}

	var users []string

	if admin {
		users, err = perms.ListAdmins(c)
	} else {
		users, err = perms.List(c, appID)
	}

	if err != nil {
		return err
	}

	if admin {
		fmt.Println("=== Administrators")
	} else {
		fmt.Printf("=== %s's Users\n", appID)
	}

	for _, user := range users {
		fmt.Println(user)
	}

	return nil
}