Skip to content

Commit f2cb656

Browse files
authored
[bbs] check webhooks permission in scm itself (#18575)
1 parent e22f6be commit f2cb656

File tree

1 file changed

+2
-23
lines changed

1 file changed

+2
-23
lines changed

components/server/src/prebuilds/bitbucket-server-service.ts

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -63,29 +63,8 @@ export class BitbucketServerService extends RepositoryService {
6363
console.log(`BBS: could not read webhooks.`, error, { error, cloneUrl });
6464
return false;
6565
}
66-
67-
if (repoKind === "users") {
68-
const ownProfile = await this.api.getUserProfile(user, identity.authName);
69-
if (owner === ownProfile.slug) {
70-
return true;
71-
}
72-
}
73-
74-
let permission = await this.api.getPermission(user, { username: identity.authName, repoKind, owner, repoName });
75-
if (!permission && repoKind === "projects") {
76-
permission = await this.api.getPermission(user, { username: identity.authName, repoKind, owner });
77-
}
78-
79-
if (this.hasPermissionToCreateWebhooks(permission)) {
80-
return true;
81-
}
82-
83-
console.log(`BBS: Not allowed to install webhooks.`, { permission });
84-
return false;
85-
}
86-
87-
protected hasPermissionToCreateWebhooks(permission: string | undefined) {
88-
return permission && ["REPO_ADMIN", "PROJECT_ADMIN"].indexOf(permission) !== -1;
66+
// return true once it can get webhooks, fallback to let SCM itself to check permission
67+
return true;
8968
}
9069

9170
async installAutomatedPrebuilds(user: User, cloneUrl: string): Promise<void> {

0 commit comments

Comments
 (0)