Add function to archive repository by onukura · Pull Request #2595 · gitbucket/gitbucket · GitHub
Skip to content

Add function to archive repository#2595

Open
onukura wants to merge 14 commits into
gitbucket:masterfrom
onukura:feat-achive
Open

Add function to archive repository#2595
onukura wants to merge 14 commits into
gitbucket:masterfrom
onukura:feat-achive

Conversation

@onukura

@onukura onukura commented Nov 11, 2020

Copy link
Copy Markdown
Member

Before submitting a pull-request to GitBucket I have first:

  • read the contribution guidelines
  • rebased my branch over master
  • verified that project is compiling
  • verified that tests are passing
  • squashed my commits as appropriate (keep several commits if it is relevant to understand the PR)
  • marked as closed using commit message all issue ID that this PR should correct

About this PR

This PR add feature to archive repository (read-only). This resolves #2152.

Intended Behavior

If repo is archived,

  • user can read repo. only except public/private setting.
  • buttons or input area related to repo. update action will be invisible.
  • API end points related to repo. update action will be unavailable.

Technical changes

  • Add ARCHIVED column to REPOSITORY table. => use like repositpry.repository.isArchived
  • Introduce UnarchivedAuthenticator to reject request on server side if repo. is archived.
  • Leave activity log when repo archive statement is changed.

Screenshot

pr_screenshot_list

@onukura onukura marked this pull request as ready for review November 15, 2020 13:37
@onukura onukura requested a review from takezoe December 7, 2020 15:01
Comment thread src/main/resources/update/gitbucket-core_4.35.xml Outdated
Comment thread src/main/scala/gitbucket/core/service/RepositoryService.scala Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We will have to ensure applying this authenticator to all possible write actions even in plugins, but ensuring it in all plugins is actually difficult or impossible.

One idea I came up with is that checking whether a repository is archived in writableUsersOnly too. This is redundant and don't cover all cases, but will automatically apply the minimum protection for the existing plugins. Or adding an option like allowUnarchivedRepository to all authenticator so that all actions currently use authenticator will need to be updated to specify that option explicitly.

Anyway, we would need to consider more carefully about how to apply the protection for archived repositories.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@takezoe Thanks for you review! I agree that applying UnarchivedAuthenticator to all write action is difficult and impossible.

checking whether a repository is archived in writableUsersOnly

That might be simple and good solution, but actually checking in writableUserOnly is not enough. Sometime we want to restrict even readableUserOnly user action if repository is archived such as "create new issue".

adding an option like allowUnarchivedRepository to all authenticator so that all actions currently use authenticator will need to be updated to specify that option explicitly.

It is more flexible than checking in writableUsersOnly, but as you said need update all actions, and even plugins...

hmm...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

checking whether a repository is archived in writableUsersOnly too

@takezoe I misunderstood what you meant about this. You mean check if repository is archived in writableUsersOnly and use UnarchivedAuthenticator for other cases such as "create new issue" (readableUserOnly) if restriction required.

In that case this idea sound better because it "will automatically apply the minimum protection for the existing plugins" as you said.

@takezoe takezoe Dec 16, 2020

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, that is what I meant. But that is also just one option. We would need to see more closely and consider possible options carefully to figure out what is the best way for this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We would need to see more closely and consider possible options carefully to figure out what is the best way for this.

@takezoe Yeah. I agree with that.

BTW I updated PR 6653dbb, 89de8fd because checking in writableUsersOnly too sounds better than before at least.

Comment thread src/main/scala/gitbucket/core/service/RepositoryService.scala Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

Freeze repository (make repository read-only)

2 participants