mirror of
https://github.com/go-gitea/gitea
synced 2025-12-07 13:28:25 +00:00
Restricted users (#4334): initial implementation
* Add User.IsRestricted & UI to edit it * Pass user object instead of user id to places where IsRestricted flag matters * Restricted users: maintain access rows for all referenced repos (incl public) * Take logged in user & IsRestricted flag into account in org/repo listings, searches and accesses * Add basic repo access tests for restricted users Signed-off-by: Manush Dodunekov <manush@stendahls.se>
This commit is contained in:
@@ -77,8 +77,7 @@ func SearchIssues(ctx *context.APIContext) {
|
||||
OwnerID: ctx.User.ID,
|
||||
TopicOnly: false,
|
||||
Collaborate: util.OptionalBoolNone,
|
||||
UserIsAdmin: ctx.IsUserSiteAdmin(),
|
||||
UserID: ctx.User.ID,
|
||||
Actor: ctx.User,
|
||||
OrderBy: models.SearchOrderByRecentUpdated,
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
@@ -126,6 +126,7 @@ func Search(ctx *context.APIContext) {
|
||||
// "$ref": "#/responses/validationError"
|
||||
|
||||
opts := &models.SearchRepoOptions{
|
||||
Actor: ctx.User,
|
||||
Keyword: strings.Trim(ctx.Query("q"), " "),
|
||||
OwnerID: ctx.QueryInt64("uid"),
|
||||
PriorityOwnerID: ctx.QueryInt64("priority_owner_id"),
|
||||
@@ -135,8 +136,6 @@ func Search(ctx *context.APIContext) {
|
||||
Collaborate: util.OptionalBoolNone,
|
||||
Private: ctx.IsSigned && (ctx.Query("private") == "" || ctx.QueryBool("private")),
|
||||
Template: util.OptionalBoolNone,
|
||||
UserIsAdmin: ctx.IsUserSiteAdmin(),
|
||||
UserID: ctx.Data["SignedUserID"].(int64),
|
||||
StarredByID: ctx.QueryInt64("starredBy"),
|
||||
IncludeDescription: ctx.QueryBool("includeDesc"),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user