mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +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:
@@ -16,7 +16,7 @@ import { getGlobalAdminRole, getGlobalMemberRole, getGlobalOwnerRole } from './r
|
||||
*/
|
||||
export async function createUser(attributes: Partial<User> = {}): Promise<User> {
|
||||
const { email, password, firstName, lastName, globalRole, ...rest } = attributes;
|
||||
const user: Partial<User> = {
|
||||
const user = Container.get(UserRepository).create({
|
||||
email: email ?? randomEmail(),
|
||||
password: await hash(password ?? randomValidPassword(), 10),
|
||||
firstName: firstName ?? randomName(),
|
||||
@@ -24,7 +24,8 @@ export async function createUser(attributes: Partial<User> = {}): Promise<User>
|
||||
globalRoleId: (globalRole ?? (await getGlobalMemberRole())).id,
|
||||
globalRole,
|
||||
...rest,
|
||||
};
|
||||
});
|
||||
user.computeIsOwner();
|
||||
|
||||
return Container.get(UserRepository).save(user);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user