mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 11:52:10 +00:00
Webhook delivery locking & Hide repo for org members if they don't have access
This commit is contained in:
parent
7b03b1df0e
commit
79262173a6
4 changed files with 31 additions and 4 deletions
|
@ -166,7 +166,9 @@ type Repository struct {
|
|||
}
|
||||
|
||||
func (repo *Repository) GetOwner() (err error) {
|
||||
repo.Owner, err = GetUserById(repo.OwnerId)
|
||||
if repo.Owner == nil {
|
||||
repo.Owner, err = GetUserById(repo.OwnerId)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -175,6 +177,14 @@ func (repo *Repository) GetMirror() (err error) {
|
|||
return err
|
||||
}
|
||||
|
||||
func (repo *Repository) HasAccess(uname string) bool {
|
||||
if err := repo.GetOwner(); err != nil {
|
||||
return false
|
||||
}
|
||||
has, _ := HasAccess(uname, path.Join(repo.Owner.Name, repo.Name), READABLE)
|
||||
return has
|
||||
}
|
||||
|
||||
// DescriptionHtml does special handles to description and return HTML string.
|
||||
func (repo *Repository) DescriptionHtml() template.HTML {
|
||||
sanitize := func(s string) string {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue