Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove redundant auth privileges #4716

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ export const CREDENTIAL_RULE_TYPES_SPACE_COMMUNITY_APPLY_GLOBAL_REGISTERED =
'credentialRuleTypes-spaceCommunityApplyGlobalRegistered';
export const CREDENTIAL_RULE_TYPES_SPACE_COMMUNITY_JOIN_GLOBAL_REGISTERED =
'credentialRuleTypes-spaceCommunityJoinGlobalRegistered';
export const CREDENTIAL_RULE_TYPES_CALLOUT_SAVE_AS_TEMPLATE =
'credentialRuleTypes-calloutSaveAsTemplate';
export const CREDENTIAL_RULE_TYPES_CALLOUT_UPDATE_PUBLISHER_ADMINS =
'credentialRuleTypes-calloutUpdatePublisherGlobalAdmins';
export const CREDENTIAL_RULE_TYPES_COMMUNITY_ADD_MEMBERS =
Expand Down
2 changes: 0 additions & 2 deletions src/common/constants/authorization/policy.rule.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ export const POLICY_RULE_COLLABORATION_CREATE =
'policyRule-collaborationCreate';
export const POLICY_RULE_COLLABORATION_WHITEBOARD_CREATE =
'policyRule-collaborationWhiteboardCreate';
export const POLICY_RULE_COLLABORATION_WHITEBOARD_CONTRIBUTORS_CREATE =
'policyRule-collaborationWhiteboardContributorsCreate';
export const POLICY_RULE_STORAGE_BUCKET_UPDATER_FILE_UPLOAD =
'policyRule-storageBucketUpdaterFileUpload';
export const POLICY_RULE_STORAGE_BUCKET_CONTRIBUTOR_FILE_UPLOAD =
Expand Down
2 changes: 0 additions & 2 deletions src/common/enums/authorization.privilege.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export enum AuthorizationPrivilege {
CREATE_MESSAGE_REPLY = 'create-message-reply',
CREATE_MESSAGE_REACTION = 'create-message-reaction',
CREATE_WHITEBOARD = 'create-whiteboard',
CREATE_WHITEBOARD_RT = 'create-whiteboard-rt',
CREATE_SPACE = 'create-space',
CREATE_SUBSPACE = 'create-subspace',
CREATE_ORGANIZATION = 'create-organization',
Expand All @@ -42,7 +41,6 @@ export enum AuthorizationPrivilege {
MOVE_CONTRIBUTION = 'move-contribution',
ACCESS_INTERACTIVE_GUIDANCE = 'access-interactive-guidance',
UPDATE_CONTENT = 'update-content',
SAVE_AS_TEMPLATE = 'save-as-template',
TRANSFER_RESOURCE = 'transfer-resource',
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import {
CREDENTIAL_RULE_COLLABORATION_CONTRIBUTORS,
POLICY_RULE_COLLABORATION_CREATE,
POLICY_RULE_CALLOUT_CONTRIBUTE,
CREDENTIAL_RULE_TYPES_CALLOUT_SAVE_AS_TEMPLATE,
POLICY_RULE_COLLABORATION_WHITEBOARD_CONTRIBUTORS_CREATE,
} from '@common/constants';
import { CommunityRoleType } from '@common/enums/community.role';
import { TimelineAuthorizationService } from '@domain/timeline/timeline/timeline.service.authorization';
Expand Down Expand Up @@ -233,15 +231,6 @@ export class CollaborationAuthorizationService {
type: AuthorizationCredential.GLOBAL_ADMIN,
resourceID: '',
});
const saveAsTemplateRule =
this.authorizationPolicyService.createCredentialRule(
[AuthorizationPrivilege.SAVE_AS_TEMPLATE],
adminCriterias,
CREDENTIAL_RULE_TYPES_CALLOUT_SAVE_AS_TEMPLATE
);

saveAsTemplateRule.cascade = false;
newRules.push(saveAsTemplateRule);

return this.authorizationPolicyService.appendCredentialAuthorizationRules(
authorization,
Expand Down Expand Up @@ -304,14 +293,6 @@ export class CollaborationAuthorizationService {
POLICY_RULE_CALLOUT_CONTRIBUTE
);
privilegeRules.push(createCalloutPrivilege);

const createWhiteboardRtContributePrivilege =
new AuthorizationPolicyRulePrivilege(
[AuthorizationPrivilege.CREATE_WHITEBOARD_RT],
AuthorizationPrivilege.CONTRIBUTE,
POLICY_RULE_COLLABORATION_WHITEBOARD_CONTRIBUTORS_CREATE
);
privilegeRules.push(createWhiteboardRtContributePrivilege);
}

return this.authorizationPolicyService.appendPrivilegeAuthorizationRules(
Expand Down