utils

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 12, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanUserEditRepository

func CanUserEditRepository(key string, repoName string) (bool, error)

Queries the database to check if the user is authorized to access the repository If the user is authorized, return true If the user is not authorized, return false

The user being authorized means that the ssh key is associated with a user that has access to the repository

func DirExists

func DirExists(path_dir string) bool

func GenerateKeyPair

func GenerateKeyPair(filepath string) error

* * This function generates a RSA Key pair * Usage: GenerateHostKey("example/key") * * it will generate: * - example/key * - example/key.pub

func GetRepoName

func GetRepoName(command string) (string, error)

Extract the repository name from the command

The command can be in the form of: - git-receive-pack '<repo-name>' - git-receive-pack '/<repo-name>' - git-receive-pack '<repo-name>/' - git-receive-pack '/<repo-name>/'

if the command doesn't have the right format, an error is returned

func IsUserAuthorized

func IsUserAuthorized(key string) (bool, error)

Queries the database to check if the user added their ssh key to the database

func MkParentdir

func MkParentdir(filepath string) error

func ParsePublicKey

func ParsePublicKey(key ssh.PublicKey) string

ParsePublicKey parses the public key to a string.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL