config/policies/permissions.js 0000644 00000004323 15112156252 0012533 0 ustar 00 const _ = require('lodash'); module.exports = async (ctx, next) => { let role; if (ctx.state.user) { // request is already authenticated in a different way return next(); } if (ctx.request && ctx.request.header && ctx.request.header.authorization) { try { const {id} = await strapi.plugins['users-permissions'].services.jwt.getToken(ctx); if (id === undefined) { throw new Error('Invalid token: Token did not contain required fields'); } // fetch authenticated user ctx.state.user = await strapi.plugins[ 'users-permissions' ].services.user.fetchAuthenticatedUser(id); } catch (err) { return handleErrors(ctx, err, 'unauthorized'); } if (!ctx.state.user) { return handleErrors(ctx, 'User Not Found', 'unauthorized'); } role = ctx.state.user.role; if (role.type === 'root') { return await next(); } const store = await strapi.store({ environment: '', type: 'plugin', name: 'users-permissions', }); if ( _.get(await store.get({key: 'advanced'}), 'email_confirmation') && !ctx.state.user.confirmed ) { return handleErrors(ctx, 'Your account email is not confirmed.', 'unauthorized'); } if (ctx.state.user.blocked) { return handleErrors( ctx, 'Your account has been blocked by the administrator.', 'unauthorized' ); } } // Retrieve `public` role. if (!role) { role = await strapi.query('role', 'users-permissions').findOne({type: 'public'}, []); } const route = ctx.request.route; const permission = await strapi.query('permission', 'users-permissions').findOne( { role: role.id, type: route.plugin || 'application', controller: route.controller, action: route.action, enabled: true, }, [] ); if (!permission) { return handleErrors(ctx, undefined, 'forbidden'); } // Execute the policies. if (permission.policy) { return await strapi.plugins['users-permissions'].config.policies[permission.policy](ctx, next); } // Execute the action. await next(); }; const handleErrors = (ctx, err = undefined, type) => { throw strapi.errors[type](err); }; config/jwt.js 0000644 00000000207 15112156252 0007152 0 ustar 00 module.exports = { jwtSecret: process.env.JWT_SECRET || 'fbae944f-170a-4e54-b008-c90741d83f99', jwt: { expiresIn: "7d", } }; controllers/Auth.js 0000644 00000060635 15112156252 0010363 0 ustar 00 'use strict'; //https://stackoverflow.com/questions/54384634/how-to-create-custom-registration-and-login-api-using-strapi /** * Auth.js controller * * @description: A set of functions called "actions" for managing `Auth`. */ /* eslint-disable no-useless-escape */ const crypto = require('crypto'); const _ = require('lodash'); const grant = require('grant-koa'); const {sanitizeEntity, getAbsoluteServerUrl} = require('strapi-utils'); const fs = require("fs"); const emailRegExp = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; const formatError = error => [ {messages: [{id: error.id, message: error.message, field: error.field}]}, ]; module.exports = { async callback(ctx) { const provider = ctx.params.provider || 'local'; const params = ctx.request.body; const {captchaId, captcha} = ctx.request.body; const isValid = await strapi.services.captcha.isValid(captchaId, captcha); if (!isValid) { return ctx.badRequest( null, 'auth.errors.invalidCaptcha' ); } const store = await strapi.store({ environment: '', type: 'plugin', name: 'users-permissions', }); if (provider === 'local') { if (!_.get(await store.get({key: 'grant'}), 'email.enabled')) { return ctx.badRequest(null, 'This provider is disabled.'); } // The identifier is required. if (!params.identifier) { return ctx.badRequest( null, 'auth.errors.fillUserName'); } // The password is required. if (!params.password) { return ctx.badRequest( null, 'auth.errors.fillPassword' ); } const query = {provider}; // Check if the provided identifier is an email or not. const isEmail = emailRegExp.test(params.identifier); // Set the identifier to the appropriate query field. if (isEmail) { query.email = params.identifier.toLowerCase(); } else { const phoneNo = strapi.services.helpers.normalizePhoneNo(params.identifier); if (!phoneNo) { return ctx.badRequest(null, 'auth.errors.invalidPhoneNo'); } params.identifier = phoneNo.toString(); query.username = params.identifier; } // Check if the user exists. const user = await strapi.query('user', 'users-permissions').findOne(query); if (!user) { return ctx.badRequest( null, 'auth.errors.invalidIdentifier' ); } if ( _.get(await store.get({key: 'advanced'}), 'email_confirmation') && user.confirmed !== true ) { return ctx.badRequest( null, 'auth.errors.emailNotConfirm', ); } if (user.blocked === true) { return ctx.badRequest( null, 'auth.errors.accountBlocked', ); } // The user never authenticated with the `local` provider. if (!user.password) { return ctx.badRequest( null, formatError({ id: 'Auth.form.error.password.local', message: 'This user never set a local password, please login with the provider used during account creation.', }) ); } const validPassword = await strapi.plugins['users-permissions'].services.user.validatePassword( params.password, user.password ); if (!validPassword) { return ctx.badRequest( null, 'auth.errors.invalidIdentifier', ); } else { const userInfo = sanitizeEntity(user.toJSON ? user.toJSON() : user, { model: strapi.query('user', 'users-permissions').model, }); userInfo.token = strapi.plugins['users-permissions'].services.jwt.issue({ id: user.id, }); userInfo.roles = [userInfo.role.name]; delete userInfo.created_by; delete userInfo.updated_by; delete userInfo.createdAt; delete userInfo.updatedAt; delete userInfo.id; delete userInfo._id; delete userInfo.confirmed; delete userInfo.blocked; delete userInfo.provider; delete userInfo.__v; delete userInfo.role; ctx.send({ ...userInfo }); } } else { if (!_.get(await store.get({key: 'grant'}), [provider, 'enabled'])) { return ctx.badRequest( null, 'auth.errors.providerDisabled', ); } // Connect the user with the third-party provider. var user, error; try { [user, error] = await strapi.plugins['users-permissions'].services.providers.connect( provider, ctx.query ); } catch ([user, error]) { return ctx.badRequest(null, error === 'array' ? error[0] : error); } if (!user) { return ctx.badRequest(null, error === 'array' ? error[0] : error); } ctx.send({ jwt: strapi.plugins['users-permissions'].services.jwt.issue({ id: user.id, }), user: sanitizeEntity(user.toJSON ? user.toJSON() : user, { model: strapi.query('user', 'users-permissions').model, }), }); } }, async resetPassword(ctx) { const params = _.assign({}, ctx.request.body, ctx.params); if ( ctx.state.user && ctx.state.user.id && params.oldPassword && params.password && params.passwordConfirmation && params.password === params.passwordConfirmation ) { //local reset pass const user = ctx.state.user; const validPassword = strapi.plugins['users-permissions'].services.user.validatePassword( params.oldPassword, user.password ); if (!validPassword) { return ctx.badRequest( null, 'auth.errors.invalidOldPassword', ); } else { const password = await strapi.plugins['users-permissions'].services.user.hashPassword({ password: params.password, }); // Update the user. await strapi .query('user', 'users-permissions') .update({id: user.id}, {resetPasswordToken: null, password}); ctx.send({ token: strapi.plugins['users-permissions'].services.jwt.issue({ id: user.id, }), }); } } else if ( params.password && params.passwordConfirmation && params.password === params.passwordConfirmation && params.code ) { const user = await strapi .query('user', 'users-permissions') .findOne({resetPasswordToken: `${params.code}`}); if (!user) { return ctx.badRequest( null, formatError({ id: 'Auth.form.error.code.provide', message: 'Incorrect code provided.', }) ); } const password = await strapi.plugins['users-permissions'].services.user.hashPassword({ password: params.password, }); // Update the user. await strapi .query('user', 'users-permissions') .update({id: user.id}, {resetPasswordToken: null, password}); ctx.send({ jwt: strapi.plugins['users-permissions'].services.jwt.issue({ id: user.id, }), user: sanitizeEntity(user.toJSON ? user.toJSON() : user, { model: strapi.query('user', 'users-permissions').model, }), }); } else if ( params.password && params.passwordConfirmation && params.password !== params.passwordConfirmation ) { return ctx.badRequest( null, formatError({ id: 'Auth.form.error.password.matching', message: 'Passwords do not match.', }) ); } else { return ctx.badRequest( null, formatError({ id: 'Auth.form.error.params.provide', message: 'Incorrect params provided.', }) ); } }, async connect(ctx, next) { const grantConfig = await strapi .store({ environment: '', type: 'plugin', name: 'users-permissions', key: 'grant', }) .get(); const [requestPath] = ctx.request.url.split('?'); const provider = requestPath.split('/')[2]; if (!_.get(grantConfig[provider], 'enabled')) { return ctx.badRequest(null, 'This provider is disabled.'); } if (!strapi.config.server.url.startsWith('http')) { strapi.log.warn( 'You are using a third party provider for login. Make sure to set an absolute url in config/server.js. More info here: https://strapi.io/documentation/v3.x/plugins/users-permissions.html#setting-up-the-server-url' ); } // Ability to pass OAuth callback dynamically grantConfig[provider].callback = _.get(ctx, 'query.callback') || grantConfig[provider].callback; grantConfig[provider].redirect_uri = strapi.plugins[ 'users-permissions' ].services.providers.buildRedirectUri(provider); return grant(grantConfig)(ctx, next); }, async forgotPassword(ctx) { let {phoneNo, newPassword, captchaId, captcha} = ctx.request.body; phoneNo = strapi.services.helpers.normalizePhoneNo(phoneNo); if (!phoneNo) { return ctx.badRequest( null, 'auth.errors.invalidPhoneNo' ); } if (captchaId) { const user = await strapi.query('user', 'users-permissions').findOne({phoneNo}); if (!user) { return ctx.badRequest( null, "auth.errors.phoneNoNotExist" ); } const isValid = await strapi.services.captcha.isValid(captchaId, captcha); if (!isValid) { return ctx.badRequest( null, "auth.errors.invalidVerifyCode" ) } // Password is required. if (!newPassword) { return ctx.badRequest( null, "errors.fillRequiredFields" ); } // Throw an error if the password selected by the user // contains more than two times the symbol '$'. if (strapi.plugins['users-permissions'].services.user.isHashed(newPassword)) { return ctx.badRequest( null, "auth.errors.passwordIsHashed" ); } const password = await strapi.plugins['users-permissions'].services.user.hashPassword({ password: newPassword, }); // Update the user. await strapi .query('user', 'users-permissions') .update({id: user.id}, {resetPasswordToken: null, password}); return ctx.send({ok: true}); } let {email} = ctx.request.body; // Check if the provided email is valid or not. const isEmail = emailRegExp.test(email); if (isEmail) { email = email.toLowerCase(); } else { return ctx.badRequest( null, formatError({ id: 'Auth.form.error.email.format', message: 'Please provide valid email address.', }) ); } const pluginStore = await strapi.store({ environment: '', type: 'plugin', name: 'users-permissions', }); // Find the user by email. const user = await strapi.query('user', 'users-permissions').findOne({email}); // User not found. if (!user) { return ctx.badRequest( null, formatError({ id: 'Auth.form.error.user.not-exist', message: 'This email does not exist.', }) ); } // Generate random token. const resetPasswordToken = crypto.randomBytes(64).toString('hex'); const settings = await pluginStore.get({key: 'email'}).then(storeEmail => { try { return storeEmail['reset_password'].options; } catch (error) { return {}; } }); const advanced = await pluginStore.get({ key: 'advanced', }); const userInfo = _.omit(user, ['password', 'resetPasswordToken', 'role', 'provider']); settings.message = await strapi.plugins['users-permissions'].services.userspermissions.template( settings.message, { URL: advanced.email_reset_password, USER: userInfo, TOKEN: resetPasswordToken, } ); settings.object = await strapi.plugins['users-permissions'].services.userspermissions.template( settings.object, { USER: userInfo, } ); try { // Send an email to the user. await strapi.plugins['email'].services.email.send({ to: user.email, from: settings.from.email || settings.from.name ? `${settings.from.name} <${settings.from.email}>` : undefined, replyTo: settings.response_email, subject: settings.object, text: settings.message, html: settings.message, }); } catch (err) { return ctx.badRequest(null, err); } // Update the user. await strapi.query('user', 'users-permissions').update({id: user.id}, {resetPasswordToken}); ctx.send({ok: true}); }, async register(ctx) { //for register may we confirm by mobile NO not been need //but for now I enable this and I'll ADJUST this item. const pluginStore = await strapi.store({ environment: '', type: 'plugin', name: 'users-permissions', }); const settings = await pluginStore.get({ key: 'advanced', }); if (!settings.allow_register) { return ctx.badRequest( null, formatError({ id: 'Auth.advanced.allow_register', message: 'Register action is currently disabled.', }) ); } const params = { ..._.omit(ctx.request.body, ['confirmed', 'resetPasswordToken']), provider: 'local', }; let {captcha, captchaId, phoneNo} = params; // Password is required. if (!params.name) { return ctx.badRequest( null, "errors.fillRequiredFields" ); } // family is required. // if (!params.family) { // return ctx.badRequest( // null, // "errors.fillRequiredFields" // ); // } // Password is required. if (!phoneNo) { return ctx.badRequest( null, "errors.fillRequiredFields" ); } phoneNo = strapi.services.helpers.normalizePhoneNo(phoneNo); if (!phoneNo) { return ctx.badRequest( null, 'auth.errors.invalidPhoneNo' ); } //check verification code const isValid = await strapi.services.captcha.isValid(captchaId, captcha); if (!isValid) { return ctx.badRequest( null, "auth.errors.invalidVerifyCode" ) } // Password is required. if (!params.password) { return ctx.badRequest( null, "errors.fillRequiredFields" ); } // Email is not required for this plan required. // if (!params.email) { // return ctx.badRequest( // null, // "errors.fillRequiredFields" // ); // } // Throw an error if the password selected by the user // contains more than two times the symbol '$'. if (strapi.plugins['users-permissions'].services.user.isHashed(params.password)) { return ctx.badRequest( null, "auth.errors.passwordIsHashed" ); } // Check if the provided email is valid or not. if (!params.email) { params.email = `u_${params.phoneNo}@optimyar.ir`; } const isEmail = emailRegExp.test(params.email); if (isEmail) { params.email = params.email.toLowerCase(); } else { return ctx.badRequest( null, "auth.errors.invalidEmail" ); } const arrUsers = await strapi.query('user', 'users-permissions').find({ _where: { _or: [{ email: params.email, }, { phoneNo: phoneNo }] } }); let user = null; if (arrUsers && arrUsers.length) { user = arrUsers[0]; } if (user && user.provider === params.provider) { return ctx.badRequest( null, "auth.errors.duplicateUserName" ); } const role = await strapi .query('role', 'users-permissions') .findOne({type: settings.default_role}, []); if (!role) { return ctx.badRequest( null, formatError({ id: 'Auth.form.error.role.notFound', message: 'Impossible to find the default role.', }) ); } params.role = role.id; params.password = await strapi.plugins['users-permissions'].services.user.hashPassword(params); if (user && user.provider !== params.provider && settings.unique_email) { return ctx.badRequest( null, formatError({ id: 'Auth.form.error.email.taken', message: 'Email is already taken.', }) ); } try { if (!settings.email_confirmation) { params.confirmed = true; } if (!params.username) { params.username = phoneNo; } params.phoneNo = phoneNo; const user = await strapi.query('user', 'users-permissions').create(params); // const jwt = strapi.plugins['users-permissions'].services.jwt.issue( // _.pick(user.toJSON ? user.toJSON() : user, ['id']) // ); if (settings.email_confirmation) { const settings = await pluginStore.get({key: 'email'}).then(storeEmail => { try { return storeEmail['email_confirmation'].options; } catch (error) { return {}; } }); settings.message = await strapi.plugins[ 'users-permissions' ].services.userspermissions.template(settings.message, { URL: `${getAbsoluteServerUrl(strapi.config)}/auth/email-confirmation`, USER: _.omit(user.toJSON ? user.toJSON() : user, [ 'password', 'resetPasswordToken', 'role', 'provider', ]), CODE: jwt, }); settings.object = await strapi.plugins[ 'users-permissions' ].services.userspermissions.template(settings.object, { USER: _.omit(user.toJSON ? user.toJSON() : user, [ 'password', 'resetPasswordToken', 'role', 'provider', ]), }); try { // Send an email to the user. await strapi.plugins['email'].services.email.send({ to: (user.toJSON ? user.toJSON() : user).email, from: settings.from.email && settings.from.name ? `${settings.from.name} <${settings.from.email}>` : undefined, replyTo: settings.response_email, subject: settings.object, text: settings.message, html: settings.message, }); } catch (err) { return ctx.badRequest(null, err); } } const userInfo = sanitizeEntity(user.toJSON ? user.toJSON() : user, { model: strapi.query('user', 'users-permissions').model, }); userInfo.token = strapi.plugins['users-permissions'].services.jwt.issue( _.pick(user.toJSON ? user.toJSON() : user, ['id']) ); userInfo.roles = [userInfo.role.name]; delete userInfo.created_by; delete userInfo.updated_by; delete userInfo.createdAt; delete userInfo.updatedAt; delete userInfo.id; delete userInfo._id; delete userInfo.confirmed; delete userInfo.blocked; delete userInfo.provider; delete userInfo.__v; delete userInfo.role; const sanitizedUser = sanitizeEntity(user.toJSON ? user.toJSON() : user, { model: strapi.query('user', 'users-permissions').model, }); if (settings.email_confirmation) { ctx.send({ user: sanitizedUser, }); } else { const inputData = [{ "name": user.name, }]; await strapi.services.helpers.sendSms(user.phoneNo, "drmdp9hfi60p8hc", inputData); const invite= fs.readFileSync('resources/emailTemplate/InvitToTelegram.html', 'utf8'); const inviteHtml = invite.replace(/COURSE_TITLE/g, "") .replace(/USER_FULL_NAME/g, user.name); strapi.services.helpers.sendEmail(user.email, "آکادمی آموزشی و پژوهشی آپتیمیار", inviteHtml).then(); ctx.send({ ...userInfo }); } } catch (err) { const adminError = _.includes(err.message, 'username') ? { id: 'Auth.form.error.username.taken', message: 'Username already taken', } : {id: 'Auth.form.error.email.taken', message: 'Email already taken'}; ctx.badRequest(null, formatError(adminError)); } }, async emailConfirmation(ctx, next, returnUser) { const params = ctx.query; const decodedToken = await strapi.plugins['users-permissions'].services.jwt.verify( params.confirmation ); let user = await strapi.plugins['users-permissions'].services.user.edit( {id: decodedToken.id}, {confirmed: true} ); if (returnUser) { ctx.send({ jwt: strapi.plugins['users-permissions'].services.jwt.issue({ id: user.id, }), user: sanitizeEntity(user.toJSON ? user.toJSON() : user, { model: strapi.query('user', 'users-permissions').model, }), }); } else { const settings = await strapi .store({ environment: '', type: 'plugin', name: 'users-permissions', key: 'advanced', }) .get(); ctx.redirect(settings.email_confirmation_redirection || '/'); } }, async sendEmailConfirmation(ctx) { const pluginStore = await strapi.store({ environment: '', type: 'plugin', name: 'users-permissions', }); const params = _.assign(ctx.request.body); if (!params.email) { return ctx.badRequest('missing.email'); } const isEmail = emailRegExp.test(params.email); if (isEmail) { params.email = params.email.toLowerCase(); } else { return ctx.badRequest('wrong.email'); } const user = await strapi.query('user', 'users-permissions').findOne({ email: params.email, }); if (user.confirmed) { return ctx.badRequest('already.confirmed'); } if (user.blocked) { return ctx.badRequest('blocked.user'); } const jwt = strapi.plugins['users-permissions'].services.jwt.issue( _.pick(user.toJSON ? user.toJSON() : user, ['id']) ); const settings = await pluginStore.get({key: 'email'}).then(storeEmail => { try { return storeEmail['email_confirmation'].options; } catch (err) { return {}; } }); const userInfo = _.omit(user, ['password', 'resetPasswordToken', 'role', 'provider']); settings.message = await strapi.plugins['users-permissions'].services.userspermissions.template( settings.message, { URL: `${getAbsoluteServerUrl(strapi.config)}/auth/email-confirmation`, USER: userInfo, CODE: jwt, } ); settings.object = await strapi.plugins['users-permissions'].services.userspermissions.template( settings.object, { USER: userInfo, } ); try { await strapi.plugins['email'].services.email.send({ to: (user.toJSON ? user.toJSON() : user).email, from: settings.from.email && settings.from.name ? `"${settings.from.name}" <${settings.from.email}>` : undefined, replyTo: settings.response_email, subject: settings.object, text: settings.message, html: settings.message, }); ctx.send({ email: (user.toJSON ? user.toJSON() : user).email, sent: true, }); } catch (err) { return ctx.badRequest(null, err); } }, }; controllers/User.js 0000644 00000007510 15112156252 0010371 0 ustar 00 'use strict'; const requestIp = require('request-ip'); const emailRegExp = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/i; const _ = require('lodash'); const {sanitizeEntity} = require('strapi-utils'); module.exports = { async update(ctx) { const {id} = ctx.params;//id must be phoneNO let {username, name, email, oldPassword, password, phoneNo, family, avatarImage} = ctx.request.body; let query = { provider: 'local', }; const isEmail = emailRegExp.test(id); // Set the identifier to the appropriate query field. if (isEmail) { query.email = id.toLowerCase(); } else { const phoneNo = strapi.services.helpers.normalizePhoneNo(id); if (phoneNo) { query.phoneNo = id } else { query.id = id; } } const user = await strapi.query('user', 'users-permissions').findOne(query); if (!user) { return ctx.badRequest("auth.errors.phoneNoNotExist"); } if (oldPassword) {//if oldpasswors not null change pass can be done const validPassword = await strapi.plugins['users-permissions'].services.user.validatePassword( oldPassword, user.password ); if (!validPassword) { return ctx.badRequest(null, "auth.errors.invalidOldPassword"); } // Throw an error if the password selected by the user // contains more than two times the symbol '$'. if (strapi.plugins['users-permissions'].services.user.isHashed(password)) { return ctx.badRequest( null, "auth.errors.passwordIsHashed" ); } password = await strapi.plugins['users-permissions'].services.user.hashPassword({username, password, email}); } if (email) { const isEmail = emailRegExp.test(email); if (isEmail) { email = email.toLowerCase(); } else { return ctx.badRequest( null, "auth.errors.invalidEmail" ); } query = { provider: 'local', email }; const existEmail = await strapi.query('user', 'users-permissions').findOne(query); if (existEmail && existEmail.id !== user.id) { return ctx.badRequest( null, "auth.errors.duplicateEmail" ); } } let updated = null; if (!oldPassword) { password = null; updated = await strapi.query('user', 'users-permissions').update({id: user.id}, { username, name, family, email, avatarImage, phoneNo }); } else { updated = await strapi.query('user', 'users-permissions').update({id: user.id}, { username, name, family, password, email, avatarImage, phoneNo }); } const userInfo = sanitizeEntity(updated.toJSON ? updated.toJSON() : updated, { model: strapi.query('user', 'users-permissions').model, }); userInfo.token = strapi.plugins['users-permissions'].services.jwt.issue( _.pick(updated.toJSON ? updated.toJSON() : user, ['id']) ); userInfo.roles = [userInfo.role.name]; delete userInfo.created_by; delete userInfo.updated_by; delete userInfo.createdAt; delete userInfo.updatedAt; delete userInfo.id; delete userInfo._id; delete userInfo.confirmed; delete userInfo.blocked; delete userInfo.provider; delete userInfo.__v; delete userInfo.role; const clientIp = requestIp.getClientIp(ctx.request.req); const inputData = [{ip: clientIp}]; strapi.services.helpers.sendSms(phoneNo, "mhb1bjmtt4", inputData).then(); strapi.services.helpers.sendEmail(userInfo.email, "ویرایش پروفایل", "
پروفایل شما ویرایش شد
").then(); return ctx.send({ ...userInfo }); }, }; documentation/1.0.0/users-permissions-Role.json 0000644 00000037534 15112156252 0015371 0 ustar 00 { "paths": { "/users-permissions/roles/{id}": { "get": { "deprecated": false, "description": "Retrieve a role depending on its id", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UsersPermissionsRole" } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "UsersPermissions - Role" ], "parameters": [ { "name": "id", "in": "path", "description": "", "deprecated": false, "required": true, "schema": { "type": "string" } } ] } }, "/users-permissions/roles": { "get": { "deprecated": false, "description": "Retrieve all role documents", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/UsersPermissionsRole" } } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "UsersPermissions - Role" ], "parameters": [ { "name": "_limit", "in": "query", "required": false, "description": "Maximum number of results possible", "schema": { "type": "integer" }, "deprecated": false }, { "name": "_sort", "in": "query", "required": false, "description": "Sort according to a specific field.", "schema": { "type": "string" }, "deprecated": false }, { "name": "_start", "in": "query", "required": false, "description": "Skip a specific number of entries (especially useful for pagination)", "schema": { "type": "integer" }, "deprecated": false }, { "name": "=", "in": "query", "required": false, "description": "Get entries that matches exactly your input", "schema": { "type": "string" }, "deprecated": false }, { "name": "_ne", "in": "query", "required": false, "description": "Get records that are not equals to something", "schema": { "type": "string" }, "deprecated": false }, { "name": "_lt", "in": "query", "required": false, "description": "Get record that are lower than a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_lte", "in": "query", "required": false, "description": "Get records that are lower than or equal to a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_gt", "in": "query", "required": false, "description": "Get records that are greater than a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_gte", "in": "query", "required": false, "description": "Get records that are greater than or equal a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_contains", "in": "query", "required": false, "description": "Get records that contains a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_containss", "in": "query", "required": false, "description": "Get records that contains (case sensitive) a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_in", "in": "query", "required": false, "description": "Get records that matches any value in the array of values", "schema": { "type": "array", "items": { "type": "string" } }, "deprecated": false }, { "name": "_nin", "in": "query", "required": false, "description": "Get records that doesn't match any value in the array of values", "schema": { "type": "array", "items": { "type": "string" } }, "deprecated": false } ] }, "post": { "deprecated": false, "description": "Create a new role", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UsersPermissionsRole" } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "UsersPermissions - Role" ], "requestBody": { "description": "", "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NewUsersPermissionsRole" } } } } } }, "/users-permissions/roles/{role}": { "put": { "deprecated": false, "description": "Update a role", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UsersPermissionsRole" } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "UsersPermissions - Role" ], "parameters": [ { "name": "role", "in": "path", "description": "", "deprecated": false, "required": true, "schema": { "type": "string" } } ], "requestBody": { "description": "", "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NewUsersPermissionsRole" } } } } }, "delete": { "deprecated": false, "description": "Delete a role", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "properties": { "foo": { "type": "string" } } } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "UsersPermissions - Role" ], "parameters": [ { "name": "role", "in": "path", "description": "", "deprecated": false, "required": true, "schema": { "type": "string" } } ] } } }, "components": { "schemas": { "UsersPermissionsRole": { "required": [ "id", "name" ], "properties": { "id": { "type": "string" }, "name": { "type": "string", "minLength": 3 }, "description": { "type": "string" }, "type": { "type": "string" }, "permissions": { "type": "array", "items": { "required": [ "id", "type", "controller", "action", "enabled" ], "properties": { "id": { "type": "string" }, "type": { "type": "string" }, "controller": { "type": "string" }, "action": { "type": "string" }, "enabled": { "type": "boolean" }, "policy": { "type": "string" }, "role": { "type": "string" }, "created_by": { "type": "string" }, "updated_by": { "type": "string" } } } }, "users": { "type": "array", "items": { "required": [ "id", "username", "email", "name", "phoneNo" ], "properties": { "id": { "type": "string" }, "username": { "type": "string" }, "email": { "type": "string" }, "provider": { "type": "string" }, "password": { "type": "string" }, "resetPasswordToken": { "type": "string" }, "confirmed": { "type": "boolean" }, "blocked": { "type": "boolean" }, "role": { "type": "string" }, "name": { "type": "string" }, "family": { "type": "string" }, "phoneNo": { "type": "integer" }, "avatarImage": { "type": "string" }, "nationalCode": { "type": "string" }, "created_by": { "type": "string" }, "updated_by": { "type": "string" } } } } } }, "NewUsersPermissionsRole": { "required": [ "name" ], "properties": { "name": { "type": "string", "minLength": 3 }, "description": { "type": "string" }, "type": { "type": "string" }, "permissions": { "type": "array", "items": { "type": "string" } }, "users": { "type": "array", "items": { "type": "string" } }, "created_by": { "type": "string" }, "updated_by": { "type": "string" } } } } }, "tags": [ { "name": "UsersPermissions - Role" } ] } documentation/1.0.0/users-permissions-User.json 0000644 00000103417 15112156252 0015400 0 ustar 00 { "paths": { "/users-permissions/search/{id}": { "get": { "deprecated": false, "description": "Search for users", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/UsersPermissionsUser" } } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "UsersPermissions - User" ], "parameters": [ { "name": "id", "in": "path", "description": "", "deprecated": false, "required": true, "schema": { "type": "string" } }, { "name": "_limit", "in": "query", "required": false, "description": "Maximum number of results possible", "schema": { "type": "integer" }, "deprecated": false }, { "name": "_sort", "in": "query", "required": false, "description": "Sort according to a specific field.", "schema": { "type": "string" }, "deprecated": false }, { "name": "_start", "in": "query", "required": false, "description": "Skip a specific number of entries (especially useful for pagination)", "schema": { "type": "integer" }, "deprecated": false }, { "name": "=", "in": "query", "required": false, "description": "Get entries that matches exactly your input", "schema": { "type": "string" }, "deprecated": false }, { "name": "_ne", "in": "query", "required": false, "description": "Get records that are not equals to something", "schema": { "type": "string" }, "deprecated": false }, { "name": "_lt", "in": "query", "required": false, "description": "Get record that are lower than a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_lte", "in": "query", "required": false, "description": "Get records that are lower than or equal to a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_gt", "in": "query", "required": false, "description": "Get records that are greater than a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_gte", "in": "query", "required": false, "description": "Get records that are greater than or equal a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_contains", "in": "query", "required": false, "description": "Get records that contains a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_containss", "in": "query", "required": false, "description": "Get records that contains (case sensitive) a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_in", "in": "query", "required": false, "description": "Get records that matches any value in the array of values", "schema": { "type": "array", "items": { "type": "string" } }, "deprecated": false }, { "name": "_nin", "in": "query", "required": false, "description": "Get records that doesn't match any value in the array of values", "schema": { "type": "array", "items": { "type": "string" } }, "deprecated": false } ] } }, "/connect/*": { "get": { "deprecated": false, "description": "Connect a provider", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "properties": { "foo": { "type": "string" } } } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "UsersPermissions - User" ], "parameters": [] } }, "/auth/local": { "post": { "deprecated": false, "description": "Login a user using the identifiers email and password", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "properties": { "foo": { "type": "string" } } } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "UsersPermissions - User" ], "requestBody": { "description": "", "required": true, "content": { "application/json": { "schema": { "properties": { "foo": { "type": "string" } } } } } } } }, "/auth/local/register": { "post": { "deprecated": false, "description": "Register a new user with the default role", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UsersPermissionsUser" } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "UsersPermissions - User" ], "requestBody": { "description": "", "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NewUsersPermissionsUser" } } } } } }, "/auth/{provider}/callback": { "get": { "deprecated": false, "description": "Successfull redirection after approving a provider", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "properties": { "foo": { "type": "string" } } } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "UsersPermissions - User" ], "parameters": [ { "name": "provider", "in": "path", "description": "", "deprecated": false, "required": true, "schema": { "type": "string" } } ] } }, "/auth/forgot-password": { "post": { "deprecated": false, "description": "Send the reset password email link", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "properties": { "foo": { "type": "string" } } } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "UsersPermissions - User" ], "requestBody": { "description": "", "required": true, "content": { "application/json": { "schema": { "properties": { "foo": { "type": "string" } } } } } } } }, "/auth/reset-password": { "post": { "deprecated": false, "description": "Reset user password with a code (resetToken)", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "properties": { "foo": { "type": "string" } } } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "UsersPermissions - User" ], "requestBody": { "description": "", "required": true, "content": { "application/json": { "schema": { "properties": { "foo": { "type": "string" } } } } } } } }, "/auth/email-confirmation": { "get": { "deprecated": false, "description": "Validate a user account", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "properties": { "foo": { "type": "string" } } } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "UsersPermissions - User" ], "parameters": [] } }, "/auth/send-email-confirmation": { "post": { "deprecated": false, "description": "Send a confirmation email to user", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "properties": { "foo": { "type": "string" } } } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "UsersPermissions - User" ], "requestBody": { "description": "", "required": true, "content": { "application/json": { "schema": { "properties": { "foo": { "type": "string" } } } } } } } }, "/users": { "get": { "deprecated": false, "description": "Retrieve all user documents", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/UsersPermissionsUser" } } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "UsersPermissions - User" ], "parameters": [ { "name": "_limit", "in": "query", "required": false, "description": "Maximum number of results possible", "schema": { "type": "integer" }, "deprecated": false }, { "name": "_sort", "in": "query", "required": false, "description": "Sort according to a specific field.", "schema": { "type": "string" }, "deprecated": false }, { "name": "_start", "in": "query", "required": false, "description": "Skip a specific number of entries (especially useful for pagination)", "schema": { "type": "integer" }, "deprecated": false }, { "name": "=", "in": "query", "required": false, "description": "Get entries that matches exactly your input", "schema": { "type": "string" }, "deprecated": false }, { "name": "_ne", "in": "query", "required": false, "description": "Get records that are not equals to something", "schema": { "type": "string" }, "deprecated": false }, { "name": "_lt", "in": "query", "required": false, "description": "Get record that are lower than a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_lte", "in": "query", "required": false, "description": "Get records that are lower than or equal to a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_gt", "in": "query", "required": false, "description": "Get records that are greater than a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_gte", "in": "query", "required": false, "description": "Get records that are greater than or equal a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_contains", "in": "query", "required": false, "description": "Get records that contains a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_containss", "in": "query", "required": false, "description": "Get records that contains (case sensitive) a value", "schema": { "type": "string" }, "deprecated": false }, { "name": "_in", "in": "query", "required": false, "description": "Get records that matches any value in the array of values", "schema": { "type": "array", "items": { "type": "string" } }, "deprecated": false }, { "name": "_nin", "in": "query", "required": false, "description": "Get records that doesn't match any value in the array of values", "schema": { "type": "array", "items": { "type": "string" } }, "deprecated": false } ] } }, "/users/me": { "get": { "deprecated": false, "description": "Retrieve the logged in user information", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UsersPermissionsUser" } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "UsersPermissions - User" ], "parameters": [] } }, "/users/{id}": { "get": { "deprecated": false, "description": "Retrieve a single user depending on his id", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UsersPermissionsUser" } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "UsersPermissions - User" ], "parameters": [ { "name": "id", "in": "path", "description": "", "deprecated": false, "required": true, "schema": { "type": "string" } } ] }, "put": { "deprecated": false, "description": "Update an existing user", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UsersPermissionsUser" } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "UsersPermissions - User" ], "parameters": [ { "name": "id", "in": "path", "description": "", "deprecated": false, "required": true, "schema": { "type": "string" } } ], "requestBody": { "description": "", "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NewUsersPermissionsUser" } } } } }, "delete": { "deprecated": false, "description": "Delete an existing user", "responses": { "200": { "description": "response", "content": { "application/json": { "schema": { "properties": { "foo": { "type": "string" } } } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }, "summary": "", "tags": [ "UsersPermissions - User" ], "parameters": [ { "name": "id", "in": "path", "description": "", "deprecated": false, "required": true, "schema": { "type": "string" } } ] } } }, "components": { "schemas": { "UsersPermissionsUser": { "required": [ "id", "username", "email", "name", "phoneNo" ], "properties": { "id": { "type": "string" }, "username": { "type": "string", "minLength": 3 }, "email": { "type": "string", "minLength": 6 }, "provider": { "type": "string" }, "confirmed": { "type": "boolean", "default": false }, "blocked": { "type": "boolean", "default": false }, "role": { "required": [ "id", "name" ], "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "description": { "type": "string" }, "type": { "type": "string" }, "permissions": { "type": "array", "items": { "type": "string" } }, "users": { "type": "array", "items": { "type": "string" } }, "created_by": { "type": "string" }, "updated_by": { "type": "string" } } }, "name": { "type": "string", "maxLength": 20, "minLength": 3 }, "family": { "type": "string", "maxLength": 20 }, "phoneNo": { "type": "integer" }, "avatarImage": { "type": "string" }, "nationalCode": { "type": "string" } } }, "NewUsersPermissionsUser": { "required": [ "username", "email", "name", "phoneNo" ], "properties": { "username": { "type": "string", "minLength": 3 }, "email": { "type": "string", "minLength": 6 }, "provider": { "type": "string" }, "password": { "type": "string", "format": "password", "minLength": 6 }, "resetPasswordToken": { "type": "string" }, "confirmed": { "type": "boolean", "default": false }, "blocked": { "type": "boolean", "default": false }, "role": { "type": "string" }, "name": { "type": "string", "maxLength": 20, "minLength": 3 }, "family": { "type": "string", "maxLength": 20 }, "phoneNo": { "type": "integer" }, "avatarImage": { "type": "string" }, "nationalCode": { "type": "string" }, "created_by": { "type": "string" }, "updated_by": { "type": "string" } } } } }, "tags": [ { "name": "UsersPermissions - User" } ] } models/Role.settings.json 0000644 00000001371 15112156252 0011464 0 ustar 00 { "kind": "collectionType", "collectionName": "users-permissions_role", "info": { "name": "role", "description": "" }, "attributes": { "name": { "type": "string", "minLength": 3, "required": true, "configurable": false }, "description": { "type": "string", "configurable": false }, "type": { "type": "string", "unique": true, "configurable": false }, "permissions": { "collection": "permission", "via": "role", "plugin": "users-permissions", "configurable": false, "isVirtual": true }, "users": { "collection": "user", "via": "role", "configurable": false, "plugin": "users-permissions" } } } models/User.settings.json 0000644 00000002764 15112156252 0011510 0 ustar 00 { "kind": "collectionType", "collectionName": "users-permissions_user", "info": { "name": "user", "description": "" }, "options": { "timestamps": true, "draftAndPublish": false }, "attributes": { "username": { "type": "string", "minLength": 3, "unique": true, "configurable": false, "required": true }, "email": { "type": "email", "minLength": 6, "configurable": false, "required": true }, "provider": { "type": "string", "configurable": false }, "password": { "type": "password", "minLength": 6, "configurable": false, "private": true }, "resetPasswordToken": { "type": "string", "configurable": false, "private": true }, "confirmed": { "type": "boolean", "default": false, "configurable": false }, "blocked": { "type": "boolean", "default": false, "configurable": false }, "role": { "model": "role", "via": "users", "plugin": "users-permissions", "configurable": false }, "name": { "type": "string", "required": true, "minLength": 3, "maxLength": 20 }, "family": { "type": "string", "required": false, "maxLength": 20 }, "phoneNo": { "type": "biginteger", "required": true }, "avatarImage": { "type": "text" }, "nationalCode": { "type": "string" } } }