Skip to content

Update User model comments about permissions #17583

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Nov 9, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions models/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,21 @@ type User struct {
// Maximum repository creation limit, -1 means use global default
MaxRepoCreation int `xorm:"NOT NULL DEFAULT -1"`

// Permissions
IsActive bool `xorm:"INDEX"` // Activate primary email
IsAdmin bool
IsRestricted bool `xorm:"NOT NULL DEFAULT false"`
// IsActive true: primary email is activated, user can access Web UI and Git SSH.
// false: an inactive user can only log in Web UI for account operations (ex: activate the account by email), no other access.
IsActive bool `xorm:"INDEX"`
// user is a Gitea admin, can access all repositories and admin pages
IsAdmin bool
// true: user is allowed to see only organizations/repositories that he has explicit rights specified
// (ex: in private Gitea instances user won't be allowed to see even organizations/repositories that are set as public)
IsRestricted bool `xorm:"NOT NULL DEFAULT false"`

AllowGitHook bool
AllowImportLocal bool // Allow migrate repository by local path
AllowCreateOrganization bool `xorm:"DEFAULT true"`
ProhibitLogin bool `xorm:"NOT NULL DEFAULT false"`

// true: user is not allowed to log in Web UI. Git SSH access could still be allowed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// true: user is not allowed to log in Web UI. Git SSH access could still be allowed.
// true: user is not allowed to log into the Web UI. Git SSH access could still be allowed.

I think Git SSH access >could< still be allowed. that could could be clarified, as in, which conditions the Git SSH access is allowed.

Copy link
Contributor Author

@wxiaoguang wxiaoguang Nov 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conditions belong to SSH access module, User model has nothing to do (no knowledge) about it.

If we need to clarify the conditions, related comments should be written in SSH access module.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont have a problem if its clarified to the SSH access module.

For someone who's trying understand what a field does and it refers to something that isnt described somewhere, then I would personally still not fully understand what the field does.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. I just added a new comment: "please refer to Git/SSH access related code/documents".

ProhibitLogin bool `xorm:"NOT NULL DEFAULT false"`

// Avatar
Avatar string `xorm:"VARCHAR(2048) NOT NULL"`
Expand Down