summaryrefslogtreecommitdiffstats
path: root/models/org.go
Commit message (Collapse)AuthorAgeFilesLines
* Fix typo (#12013)successgo2020-06-221-1/+1
| | | | | | | | | | | * Fix typo of MSSQL * Fix typo: validates * Fix typo * fix comment with space Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Prevent multiple listings of organization when creating a repository (#11303)65432020-05-071-6/+6
| | | | | | | | | | | prevent double entries in results of GetOrgsCanCreateRepoByUserID I first try to only add GroupBy directly but xorm return broken user objects ... ... solution was to just query related UserIDs(OrgIDs) first and return OrgUsers based on this IDs close #11258 Co-authored-by: zeripath <art27@cantab.net>
* Ensure DeleteUser is not allowed to Delete Orgs and visa versa (#10134)65432020-02-041-4/+4
| | | | | | | | | | | | | | * add check to DeleteUser * add check to DeleteOrganization * add Test * remove redundancy (deleteOrg is only used in DeleteOrganization) * Update models/org.go Co-authored-by: zeripath <art27@cantab.net>
* API add/generalize pagination (#9452)SpaWn2KiLl2020-01-241-19/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * paginate results * fixed deadlock * prevented breaking change * updated swagger * go fmt * fixed find topic * go mod tidy * go mod vendor with go1.13.5 * fixed repo find topics * fixed unit test * added Limit method to Engine struct; use engine variable when provided; fixed gitignore * use ItemsPerPage for default pagesize; fix GetWatchers, getOrgUsersByOrgID and GetStargazers; fix GetAllCommits headers; reverted some changed behaviors * set Page value on Home route * improved memory allocations * fixed response headers * removed logfiles * fixed import order * import order * improved swagger * added function to get models.ListOptions from context * removed pagesize diff on unit test * fixed imports * removed unnecessary struct field * fixed go fmt * scoped PR * code improvements * code improvements * go mod tidy * fixed import order * fixed commit statuses session * fixed files headers * fixed headers; added pagination for notifications * go mod tidy * go fmt * removed Private from user search options; added setting.UI.IssuePagingNum as default valeu on repo's issues list * Apply suggestions from code review Co-Authored-By: 6543 <6543@obermui.de> Co-Authored-By: zeripath <art27@cantab.net> * fixed build error * CI.restart() * fixed merge conflicts resolve * fixed conflicts resolve * improved FindTrackedTimesOptions.ToOptions() method * added backwards compatibility on ListReleases request; fixed issue tracked time ToSession * fixed build error; fixed swagger template * fixed swagger template * fixed ListReleases backwards compatibility * added page to user search route Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
* Restricted users (#6274)Manush Dodunekov2020-01-131-6/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 5c3e886aabd5acd997a3b35687d322439732c200. Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* Only show part of members on orgnization dashboard and add paging for ↵Lunny Xiao2019-12-061-12/+45
| | | | | | | | | | orgnization members page (#9092) * Only show part of members on orgnization dashboard and add paging for orgnization members page * fix test * fix typo
* Team permission to create repository in organization (#8312)David Svantesson2019-11-201-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add team permission setting to allow creating repo in organization. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Add test case for creating repo when have team creation access. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * build error: should omit comparison to bool constant Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Add comment on exported functions * Fix fixture consistency, fix existing unit tests * Fix boolean comparison in xorm query. * addCollaborator and changeCollaborationAccessMode separate steps More clear to use different if-cases. * Create and commit xorm session * fix * Add information of create repo permission in team sidebar * Add migration step * Clarify that repository creator will be administrator. * Fix some things after merge * Fix language text that use html * migrations file * Create repository permission -> Create repositories * fix merge * fix review comments
* Add team option to grant rights for all organization repositories (#8688)David Svantesson2019-11-061-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add field IsAllRepositories to team * Add AllRepositories to team UI * Manage team with access to all repositories * Add field IsAllRepositories to team API * put backticks around table/column names * rename IsAllRepositories to IncludesAllRepositories * do not reload slice if already loaded * add repo to teams with access to all repositories when changing repo owner * improve tests for teams with access to all repositories * Merge branch 'master' * Change code for adding all repositories Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * fmt after merge * Change code in API EditTeam similar to EditTeamPost web interface Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Clarify that all repositories will be added Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * All repositories option under Permissions headline * New setting group 'Repository access' * Move check IncludeAllRepositories to removeRepository. * Revert "Move check IncludeAllRepositories to removeRepository." and add comment instead. This reverts commit 753b7d205be260b8be465b5291a02975a81f3093. * Clarify help text what options do.
* Upgrade xorm to v0.8.0 (#8536)Lunny Xiao2019-10-171-1/+1
|
* Add teams to repo on collaboration page. (#8045)David Svantesson2019-09-231-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add teams to repo on collaboration page. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Add option for repository admins to change teams access to repo. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Add comment for functions Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Make RepoAdminChangeTeamAccess default false in xorm and make it default checked in template instead. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Make proper language strings and fix error redirection. * Add unit tests for adding and deleting team from repository. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Add database migration Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Fix redirect Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Fix locale string mismatch. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Move team access mode text logic to template. * Move collaborator access mode text logic to template.
* Add support for DEFAULT_ORG_MEMBER_VISIBLE (#7669)guillep2k2019-08-241-2/+4
| | | | | | | | | | | | * Add support for DEFAULT_ORG_MEMBER_VISIBLE * Correct formatting * Improved description in cheat sheet. * Add test for DefaultOrgMemberVisible * Remove dead code
* Use gitea forked macaron (#7933)Tamal Saha2019-08-231-1/+1
| | | Signed-off-by: Tamal Saha <tamal@appscode.com>
* org/members: display 2FA members states + optimize sql requests (#7621)Antoine GIRARD2019-08-021-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * org/members: display 2FA state * fix comment typo * lay down UserList bases * add basic test for previous methods * add comment for UserList type * add valid two-fa account * test new UserList methods * optimize MembersIsPublic by side loading info on GetMembers + fix integrations tests * respect fmt rules * use map for data * Optimize GetTwoFaStatus * rewrite by using existing sub func * Optimize IsUserOrgOwner * remove un-used code * tests: cover empty org + fix import order * tests: add ErrTeamNotExist path * tests: fix wrong expected result
* Fix error log when loading issues caused by a xorm bug (#7271)Lunny Xiao2019-06-231-1/+1
| | | | | | | | | | | | * fix error log when loading issues caused by a xorm bug * upgrade packages * fix fmt * fix Consistency * fix tests
* Add golangci (#6418)kolaente2019-06-121-7/+10
|
* Fixes #5960 - Adds API Endpoint for Repo Edit (#7006)Richard Mahn2019-05-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Feature - #5960 - API Endpoint for Repo Editing * Revert from merge * Adds integration testing * Updates to integration tests * Revert changes * Update year in file header * Misspell fix * XORM = test * XORM = test * revert XORM = file * Makes RepoUnit.ID be pk and autoincr * Fix to units * revert header * Remove print statement * Adds other responses * Improves swagger for creating repo * Fixes import order * Better Unit Type does not exist error * Adds editable repo properties to the response repo structure * Fix to api_repo_edit_test.go * Fixes repo test * Changes per review * Fixes typo and standardizes comments in the EditRepoOption struct for swagger * Fixes typo and standardizes comments in the EditRepoOption struct for swagger * Actually can unarchive through the API * Unlike delete, user doesn't have to be the owner of the org, just admin to the repo * Fix to swagger comments for field name change * Update to swagger docs * Update swagger * Changes allow_pull_requests to has_pull_requests
* Fix org visibility bug when git cloning (#6743)Lunny Xiao2019-04-251-1/+5
| | | | | | | | | | | | | | * fix org visibility bug * fix permission check * add integration tests * fix tests * change test user name for easier maintainance and fix test * fix test git repo name
* Fix: Sort repos on org home page with non-admin login (#6741)Lunny Xiao2019-04-241-3/+11
|
* Better logging (#6038) (#6095)zeripath2019-04-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Panic don't fatal on create new logger Fixes #5854 Signed-off-by: Andrew Thornton <art27@cantab.net> * partial broken * Update the logging infrastrcture Signed-off-by: Andrew Thornton <art27@cantab.net> * Reset the skip levels for Fatal and Error Signed-off-by: Andrew Thornton <art27@cantab.net> * broken ncsa * More log.Error fixes Signed-off-by: Andrew Thornton <art27@cantab.net> * Remove nal * set log-levels to lowercase * Make console_test test all levels * switch to lowercased levels * OK now working * Fix vetting issues * Fix lint * Fix tests * change default logging to match current gitea * Improve log testing Signed-off-by: Andrew Thornton <art27@cantab.net> * reset error skip levels to 0 * Update documentation and access logger configuration * Redirect the router log back to gitea if redirect macaron log but also allow setting the log level - i.e. TRACE * Fix broken level caching * Refactor the router log * Add Router logger * Add colorizing options * Adjust router colors * Only create logger if they will be used * update app.ini.sample * rename Attribute ColorAttribute * Change from white to green for function * Set fatal/error levels * Restore initial trace logger * Fix Trace arguments in modules/auth/auth.go * Properly handle XORMLogger * Improve admin/config page * fix fmt * Add auto-compression of old logs * Update error log levels * Remove the unnecessary skip argument from Error, Fatal and Critical * Add stacktrace support * Fix tests * Remove x/sync from vendors? * Add stderr option to console logger * Use filepath.ToSlash to protect against Windows in tests * Remove prefixed underscores from names in colors.go * Remove not implemented database logger This was removed from Gogs on 4 Mar 2016 but left in the configuration since then. * Ensure that log paths are relative to ROOT_PATH * use path.Join * rename jsonConfig to logConfig * Rename "config" to "jsonConfig" to make it clearer * Requested changes * Requested changes: XormLogger * Try to color the windows terminal If successful default to colorizing the console logs * fixup * Colorize initially too * update vendor * Colorize logs on default and remove if this is not a colorizing logger * Fix documentation * fix test * Use go-isatty to detect if on windows we are on msys or cygwin * Fix spelling mistake * Add missing vendors * More changes * Rationalise the ANSI writer protection * Adjust colors on advice from @0x5c * Make Flags a comma separated list * Move to use the windows constant for ENABLE_VIRTUAL_TERMINAL_PROCESSING * Ensure matching is done on the non-colored message - to simpify EXPRESSION
* Allow to set organization visibility (public, internal, private) (#1763)Rémy Boulanouar2019-02-181-0/+36
|
* Feature - #3031 - search for org repos (#5986)Richard Mahn2019-02-081-0/+9
|
* api: Add missing GET teams endpoints (#5382)Harshit Bansal2019-01-161-1/+1
| | | | | | | | | | | | | | | | | | | | * api: Add an endpoint to list a particular member of team. * models: Rename `GetUserTeams()` to `GetUserOrgTeams()` in `org_team` model. `GetUserTeams()` sounds a bit misnomer since it actually returns the teams that user belongs to in a given organization rather than all the teams across all the organization that the user has joined. * models: Add `GetUserTeams()`. Returns all the teams that a user belongs to. * api: Add an endpoint for GET '/user/teams'. A GET request to this endpoint lists all the teams that a user belongs to.
* Ensure that sessions are passed into queries that could use the database to ↵zeripath2019-01-131-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | prevent deadlocks (#5718) * Fixed deadlock in CreateComment * Fix possible deadlock in UpdateIssueDeadline from createDeadlineComment * Ensure that calls to IsTimeTracker enabled are called within session Signed-off-by: Andrew Thornton <art27@cantab.net> * Ensure that calls to reactionList are also called within session Signed-off-by: Andrew Thornton <art27@cantab.net> * Ensure all calls in NewPullRequest with the session are called within the session Signed-off-by: Andrew Thornton <art27@cantab.net> * Deal with potential deadlocks in repo Signed-off-by: Andrew Thornton <art27@cantab.net> * Ensure that isStaring is checked within our transaction Signed-off-by: Andrew Thornton <art27@cantab.net> * Fix mistake in isOrganizationMember Sorry.
* Fix sqlite deadlock when assigning to a PR (#5640)zeripath2019-01-041-1/+5
| | | | | | | | | | | | * Fix sqlite deadlock when assigning to a PR Fix 5639 Signed-off-by: Andrew Thornton <art27@cantab.net> * More possible deadlocks found and fixed Signed-off-by: Andrew Thornton <art27@cantab.net>
* fix sqlite and mssql lock (#5214)Lunny Xiao2018-10-291-12/+22
|
* Remove check for negative length (#5120)Oleg Kovalov2018-10-201-2/+2
|
* Do not autocreate directory for new user/orgs (#4828) (#4849)SagePtr2018-09-061-4/+0
|
* Fix out-of-transaction query in removeOrgUser (#4521) (#4522)SagePtr2018-07-271-1/+1
|
* Update xorm to latest version and fix correct `user` table referencing in ↵Lauris BH2018-07-201-2/+2
| | | | sql (#4473)
* hide issues from org private repos w/o team assignment (#4034)David Schneiderbauer2018-06-211-1/+16
|
* Fix remove team member issue (#3566)Wendell Sun2018-02-231-8/+14
| | | | | Put sess.Commit() out of the RemoveOrgUser function Add an empty line to separate import packages
* Remove IsOwner, NumTeams from OrgUser (#3269)Ethan Koenig2018-01-081-15/+23
|
* Fix ignored errors when checking if organization, team member (#3177)Ethan Koenig2017-12-211-18/+21
|
* fix org owner cannot be removed if there is not in owner team (#3164)Lunny Xiao2017-12-131-1/+6
|
* Hide unactive on explore users and some refactors (#2741)Lunny Xiao2017-10-241-17/+0
| | | | | | | | | | | | | | | | | | | | | | | | * hide unactive on explore users and some refactors * fix test for removed Organizations * fix test for removed Organizations * fix imports * fix logic bug * refactor the toConds * Rename TestOrganizations to TestSearchUsers and add tests for users * fix other tests * fix other tests * fix watchers tests * fix comments and remove unused code
* Replace deprecated Id method with ID (#2655)Ethan Koenig2017-10-051-3/+3
|
* Reduce usage of allcols on update (#2596)Lunny Xiao2017-09-251-1/+1
| | | | | | * reduce usage of allcols on update * fix bug and tests
* Fix lint errors (#2547)Ethan Koenig2017-09-191-5/+1
|
* Fixes 500 error on dashboard when using MSSQL (#2504)bradder5552017-09-151-1/+1
| | | | | | | | | | | | | | MSSQL rejects the query: SELECT "repository"."id" FROM "repository" INNER JOIN "team_repo" ON "team_repo".repo_id="repository".id AND "repository".is_mirror=1 WHERE ( ("repository".owner_id=2 AND "repository".is_private=0) OR team_repo.team_id IN (1) ) GROUP BY "repository".id ORDER BY updated_unix DESC when the order by term (updated_unix) is not included in the group by term.
* improve protected branch to add whitelist support (#2451)Lunny Xiao2017-09-141-0/+5
| | | | | | | | | | | | | | | | | | | | * improve protected branch to add whitelist support * fix lint * fix style check * fix tests * fix description on UI and import * fix test * bug fixed * fix tests and languages * move isSliceInt64Eq to util pkg; improve function names & typo
* Improve org error handling (#2117)Antoine GIRARD2017-07-061-4/+2
| | | | | | | | | | * Improve ErrOrgNotExist type Return new error type Use good error check Use new method to check error Update tests * Fix unchanged method name report
* Refactor session close as xorm already does everything needed internally (#2020)Lauris BH2017-06-211-2/+2
|
* Fix bug in removeOrgRepo (#1858)Ethan Koenig2017-06-021-1/+1
|
* Fix locking bug in removeOrgRepo (#1842)Ethan Koenig2017-06-011-1/+1
|
* Give all units to owner team (#1812)Ethan Koenig2017-05-261-0/+1
|
* fix migrate failed and org dashboard failed on MSSQL database (#1448)Lunny Xiao2017-04-061-4/+21
|
* fix random avatars (#1147)Lunny Xiao2017-03-081-1/+3
|
* fix del org avatar potential delete all avtars (#1120)Lunny Xiao2017-03-061-4/+6
|
* Remove unnecessary loads in org_team (#1035)Ethan Koenig2017-02-241-1/+1
|
* bug fixed on issues and pullsLunny Xiao2017-02-151-1/+0
|