Ejemplo n.º 1
0
func SSHAllowed(args []string, spaceFactory space.SpaceFactory, output io.Writer) error {
	if len(args) != 2 || args[0] != "space-ssh-allowed" {
		return fmt.Errorf("%s\n%s", "Invalid usage", SSHAllowedUsage)
	}

	space, err := spaceFactory.Get(args[1])
	if err != nil {
		return err
	}

	fmt.Fprintf(output, "%t", space.AllowSSH)
	return nil
}
Ejemplo n.º 2
0
func DisallowSSH(args []string, spaceFactory space.SpaceFactory) error {
	if len(args) != 2 || args[0] != "disallow-space-ssh" {
		return fmt.Errorf("%s\n%s", "Invalid usage", DisallowSSHUsage)
	}

	space, err := spaceFactory.Get(args[1])
	if err != nil {
		return err
	}

	err = spaceFactory.SetBool(space, "allow_ssh", false)
	if err != nil {
		return err
	}

	return nil
}