mirror of
https://github.com/go-gitea/gitea
synced 2024-10-31 23:34:25 +00:00
1751d5fcf2
* 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>
* Mention restricted users in the faq
Signed-off-by: Manush Dodunekov <manush@stendahls.se>
* Revert unnecessary change `.isUserPartOfOrg` -> `.IsUserPartOfOrg`
Signed-off-by: Manush Dodunekov <manush@stendahls.se>
* Remove unnecessary `org.IsOrganization()` call
Signed-off-by: Manush Dodunekov <manush@stendahls.se>
* Revert to an `int64` keyed `accessMap`
* Add type `userAccess`
* Add convenience func updateUserAccess()
* Turn accessMap into a `map[int64]userAccess`
Signed-off-by: Manush Dodunekov <manush@stendahls.se>
* or even better: `map[int64]*userAccess`
* updateUserAccess(): use tighter syntax as suggested by lafriks
* even tighter
* Avoid extra loop
* Don't disclose limited orgs to unauthenticated users
* Don't assume block only applies to orgs
* Use an array of `VisibleType` for filtering
* fix yet another thinko
* Ok - no need for u
* Revert "Ok - no need for u"
This reverts commit 5c3e886aab
.
Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
51 lines
1.7 KiB
Go
51 lines
1.7 KiB
Go
// Copyright 2014 The Gogs Authors. All rights reserved.
|
|
// Use of this source code is governed by a MIT-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package auth
|
|
|
|
import (
|
|
"gitea.com/macaron/binding"
|
|
"gitea.com/macaron/macaron"
|
|
)
|
|
|
|
// AdminCreateUserForm form for admin to create user
|
|
type AdminCreateUserForm struct {
|
|
LoginType string `binding:"Required"`
|
|
LoginName string
|
|
UserName string `binding:"Required;AlphaDashDot;MaxSize(40)"`
|
|
Email string `binding:"Required;Email;MaxSize(254)"`
|
|
Password string `binding:"MaxSize(255)"`
|
|
SendNotify bool
|
|
MustChangePassword bool
|
|
}
|
|
|
|
// Validate validates form fields
|
|
func (f *AdminCreateUserForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
|
|
return validate(errs, ctx.Data, f, ctx.Locale)
|
|
}
|
|
|
|
// AdminEditUserForm form for admin to create user
|
|
type AdminEditUserForm struct {
|
|
LoginType string `binding:"Required"`
|
|
LoginName string
|
|
FullName string `binding:"MaxSize(100)"`
|
|
Email string `binding:"Required;Email;MaxSize(254)"`
|
|
Password string `binding:"MaxSize(255)"`
|
|
Website string `binding:"ValidUrl;MaxSize(255)"`
|
|
Location string `binding:"MaxSize(50)"`
|
|
MaxRepoCreation int
|
|
Active bool
|
|
Admin bool
|
|
Restricted bool
|
|
AllowGitHook bool
|
|
AllowImportLocal bool
|
|
AllowCreateOrganization bool
|
|
ProhibitLogin bool
|
|
}
|
|
|
|
// Validate validates form fields
|
|
func (f *AdminEditUserForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
|
|
return validate(errs, ctx.Data, f, ctx.Locale)
|
|
}
|