mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 19:11:13 +00:00
feat: Replace owner checks with scope checks (no-changelog) (#7846)
Github issue / Community forum post (link here to close automatically):
This commit is contained in:
@@ -415,11 +415,11 @@ export async function replaceInvalidCredentials(workflow: WorkflowEntity): Promi
|
||||
|
||||
/**
|
||||
* Get the IDs of the workflows that have been shared with the user.
|
||||
* Returns all IDs if user is global owner (see `whereClause`)
|
||||
* Returns all IDs if user has the 'workflow:read' scope (see `whereClause`)
|
||||
*/
|
||||
export async function getSharedWorkflowIds(user: User, roles?: RoleNames[]): Promise<string[]> {
|
||||
const where: FindOptionsWhere<SharedWorkflow> = {};
|
||||
if (user.globalRole?.name !== 'owner') {
|
||||
if (!(await user.hasGlobalScope('workflow:read'))) {
|
||||
where.userId = user.id;
|
||||
}
|
||||
if (roles?.length) {
|
||||
|
||||
Reference in New Issue
Block a user