Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

egg-born-module-a-base-sync

Package Overview
Dependencies
Maintainers
1
Versions
354
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

egg-born-module-a-base-sync - npm Package Compare versions

Comparing version 4.8.11 to 4.8.12

8

backend/src/bean/atom.role.js

@@ -87,3 +87,9 @@ module.exports = app => {

async write({ atomClass, target, key, item, options, user }) {
delete item.roleIdParent; // roleIdParent maybe string, so cause validate error
// check demo
const ctxCaller = this.ctx.ctxCaller;
if (ctxCaller && ctxCaller.path === '/api/a/base/atom/write') {
this.ctx.bean.util.checkDemo();
}
// roleIdParent maybe string, so cause validate error
delete item.roleIdParent;
// super

@@ -90,0 +96,0 @@ await super.write({ atomClass, target, key, item, options, user });

@@ -62,2 +62,7 @@ module.exports = app => {

async write({ atomClass, target, key, item, options, user }) {
// check demo
const ctxCaller = this.ctx.ctxCaller;
if (ctxCaller && ctxCaller.path === '/api/a/base/atom/write') {
this.ctx.bean.util.checkDemo();
}
// super

@@ -85,2 +90,7 @@ await super.write({ atomClass, target, key, item, options, user });

async enable({ atomClass, key, user }) {
// check demo
const ctxCaller = this.ctx.ctxCaller;
if (ctxCaller && ctxCaller.path === '/api/a/base/atom/enable') {
this.ctx.bean.util.checkDemo();
}
// super

@@ -96,2 +106,7 @@ await super.enable({ atomClass, key, user });

async disable({ atomClass, key, user }) {
// check demo
const ctxCaller = this.ctx.ctxCaller;
if (ctxCaller && ctxCaller.path === '/api/a/base/atom/disable') {
this.ctx.bean.util.checkDemo();
}
// super

@@ -98,0 +113,0 @@ await super.disable({ atomClass, key, user });

3

backend/src/bean/bean.util.js

@@ -195,4 +195,3 @@ const require3 = require('require3');

let _sep, _parts;
for (let index = 0; index < sep.length; index++) {
_sep = sep[index];
for (_sep of sep) {
_parts = key.split(_sep);

@@ -199,0 +198,0 @@ if (_parts.length > 1) break;

@@ -36,16 +36,27 @@ const require3 = require('require3');

async _initUsers(roleIds, options) {
// root user
// users
const users = [];
// user: root
const userRoot = extend(true, {}, initData.users.root);
userRoot.item.email = options.email;
userRoot.item.mobile = options.mobile;
const userId = await ctx.bean.user.add(userRoot.item);
// activated
await ctx.bean.user.save({
user: { id: userId, activated: 1 },
});
// user->role
await ctx.bean.role.addUserRole({
userId,
roleId: roleIds[userRoot.roleId],
});
users.push(userRoot);
// user: admin
const demo = ctx.config.module(moduleInfo.relativeName).configFront.demo;
if (demo.enable) {
const userAdmin = extend(true, {}, initData.users.admin);
users.push(userAdmin);
}
for (const user of users) {
const userId = await ctx.bean.user.add(user.item);
// activated
await ctx.bean.user.save({
user: { id: userId, activated: 1 },
});
// user->role
await ctx.bean.role.addUserRole({
userId,
roleId: roleIds[user.roleId],
});
}
}

@@ -52,0 +63,0 @@ }

@@ -104,2 +104,14 @@ // roles

},
admin: {
item: {
userName: 'admin',
realName: 'admin',
email: null,
mobile: null,
avatar: null,
motto: null,
locale: null,
},
roleId: 'superuser',
},
};

@@ -106,0 +118,0 @@

{
"name": "egg-born-module-a-base-sync",
"version": "4.8.11",
"version": "4.8.12",
"title": "Base",

@@ -5,0 +5,0 @@ "eggBornModule": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc