MCPcopy
hub / github.com/harness/harness / getRepoCheckAccess

Method getRepoCheckAccess

app/api/controller/pullreq/controller.go:195–216  ·  view source on GitHub ↗

nolint:unparam

(
	ctx context.Context,
	session *auth.Session,
	repoRef string,
	reqPermission enum.Permission,
	allowedRepoStates ...enum.RepoState,
)

Source from the content-addressed store, hash-verified

193
194//nolint:unparam
195func (c *Controller) getRepoCheckAccess(
196 ctx context.Context,
197 session *auth.Session,
198 repoRef string,
199 reqPermission enum.Permission,
200 allowedRepoStates ...enum.RepoState,
201) (*types.RepositoryCore, error) {
202 repo, err := c.getRepo(ctx, repoRef)
203 if err != nil {
204 return nil, err
205 }
206
207 if err := apiauth.CheckRepoState(ctx, session, repo, reqPermission, allowedRepoStates...); err != nil {
208 return nil, err
209 }
210
211 if err = apiauth.CheckRepo(ctx, c.authorizer, session, repo, reqPermission); err != nil {
212 return nil, fmt.Errorf("access check failed: %w", err)
213 }
214
215 return repo, nil
216}
217
218func (c *Controller) fetchRules(
219 ctx context.Context,

Callers 15

RevertMethod · 0.95
CommentUpdateMethod · 0.95
DeleteBranchMethod · 0.95
FindMethod · 0.95
FindByBranchesMethod · 0.95
PRBranchCandidatesMethod · 0.95
FileViewDeleteMethod · 0.95
ActivityListMethod · 0.95
UpdateMethod · 0.95
CodeOwnersMethod · 0.95
ReviewersListCombinedMethod · 0.95
RestoreBranchMethod · 0.95

Calls 2

getRepoMethod · 0.95
ErrorfMethod · 0.45

Tested by

no test coverage detected