nolint:unparam
( ctx context.Context, session *auth.Session, repoRef string, reqPermission enum.Permission, allowedRepoStates ...enum.RepoState, )
| 193 | |
| 194 | //nolint:unparam |
| 195 | func (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 | |
| 218 | func (c *Controller) fetchRules( |
| 219 | ctx context.Context, |
no test coverage detected