pull/15126/head
Alberto Romeu 5 years ago
commit 6102057e85

@ -229,7 +229,7 @@ class SessionsController < ApplicationController
redirect_to login_url + "?error=#{MULTIFACTOR_AUTHENTICATION_INACTIVITY}"
end
def create_user(username, organization_id, email, created_via)
def create_user(username, organization_id, email, created_via, &config_account_creator_block)
@organization = ::Organization.where(id: organization_id).first
account_creator = CartoDB::UserAccountCreator.new(created_via)
@ -238,6 +238,10 @@ class SessionsController < ApplicationController
.with_username(username)
account_creator.with_email(email) unless email.nil?
# Allows externals gears to override this method and add further configuration to the
# account creator
config_account_creator_block.call(account_creator) if config_account_creator_block.present?
if account_creator.valid?
creation_data = account_creator.enqueue_creation(self)

@ -20,7 +20,7 @@
<label class="CDB-Text CDB-Size-medium is-semibold u-mainTextColor"><%= _t('profile.views.form.user_type') %></label>
</div>
<div class="FormAccount-rowData FormAccount-userRole">
<% if (role == 'viewer') { %>
<% if (role === 'viewer') { %>
<div>
<span class="UserRoleIndicator Viewer CDB-Text CDB-Size-small is-semibold u-altTextColor"><%= _t('profile.views.form.viewer') %></span>
<% if (hasOrganization) { %>
@ -28,10 +28,11 @@
<% } %>
</div>
<p class="CDB-Text CDB-Size-small u-altTextColor u-tSpace"><%= _t('profile.views.form.read_only') %></p>
<% } else if (role == 'builder') { %>
<% } else if (role === 'builder') { %>
<span class="UserRoleIndicator Builder CDB-Text CDB-Size-small is-semibold u-altTextColor"><%= _t('profile.views.form.builder') %></span>
<p class="CDB-Text CDB-Size-small u-altTextColor u-tSpace"><%= _t('profile.views.form.write_access') %></p>
<% } else { %>
<!-- for custom role names (via gears) -->
<span class="UserRoleIndicator Builder CDB-Text CDB-Size-small is-semibold u-altTextColor"><%= role %></span>
<p class="CDB-Text CDB-Size-small u-altTextColor u-tSpace">
<% if (isViewer) { %>

@ -24,6 +24,9 @@ const TWITTER_USERNAME = 'twitter_username';
const DISQUS_SHORTNAME = 'disqus_shortname';
const AVAILABLE_FOR_HIRE = true;
const LOCATION = 'location';
const BUILDER_ROLE_DISPLAY = 'builder';
const VIEWER_ROLE_DISPLAY = 'viewer';
const CUSTOM_ROLE_DISPLAY = 'custom';
const PASSWORD = 'password';
const MALICIOUS_TEXT = '/><script>alert("wadus");</script>';
const ESCAPED_TEXT = '/&gt;&lt;script&gt;alert(&quot;wadus&quot;);&lt;/script&gt;';
@ -55,6 +58,7 @@ describe('dashboard/views/profile/profile-form/profile-form-view', function () {
available_for_hire: AVAILABLE_FOR_HIRE,
location: LOCATION,
viewer: false,
role_display: BUILDER_ROLE_DISPLAY,
needs_password_confirmation: true
}, options)
);
@ -211,7 +215,7 @@ describe('dashboard/views/profile/profile-form/profile-form-view', function () {
describe('is viewer', function () {
beforeEach(function () {
userModel.set('viewer', true);
spyOn(userModel, 'role').and.returnValue(VIEWER_ROLE_DISPLAY);
});
describe('.render', function () {
@ -224,14 +228,27 @@ describe('dashboard/views/profile/profile-form/profile-form-view', function () {
});
});
describe('is inside org', function () {
describe('has custom role', function () {
beforeEach(function () {
spyOn(userModel, 'role').and.returnValue(CUSTOM_ROLE_DISPLAY);
});
describe('.render', function () {
it('should render properly', function () {
view.render();
expect(view.$el.html()).toContain(CUSTOM_ROLE_DISPLAY);
});
});
});
describe('is viewer inside org', function () {
beforeEach(function () {
spyOn(userModel, 'role').and.returnValue(VIEWER_ROLE_DISPLAY);
spyOn(userModel, 'isInsideOrg').and.returnValue(true);
});
describe('.render', function () {
it('should render properly', function () {
spyOn(userModel, 'isViewer').and.returnValue(true);
spyOn(view, '_getOrgAdminEmail').and.returnValue(DISPLAY_EMAIL);
view.render();

@ -123,7 +123,6 @@ var gearEntryPoints = {};
console.info(`> Found HtmlWebpackPlugin extension for gear ${gearName} in ${gearWebpackFilesPath}`);
Object.entries(gearWebpackFiles.htmlFiles).forEach(([entryName, config]) => {
if (!files[entryName]) {
console.info(`> ┕╸ Added entryName "${entryName}"`);
files[entryName] = {};
@ -138,7 +137,6 @@ var gearEntryPoints = {};
files[entryName][confName] = val;
}
});
});
}
// Find entry point overrides

@ -1,6 +1,6 @@
{
"name": "cartodb-ui",
"version": "1.0.0-assets.162",
"version": "1.0.0-assets.161-meridian-01",
"description": "CARTO UI frontend",
"repository": {
"type": "git",

@ -5,7 +5,6 @@ const Package = require('./../../package.json');
const VERSION = Package.version;
module.exports = {
entry: Object.assign({
main: './lib/assets/javascripts/dashboard/statics/static.js'

@ -31,7 +31,7 @@ function rootDir (file, opts = {}) {
;
// Try to look for full folder overriding, preceded by @
if (!fileExistsAndBoundedToGear){
if (!fileExistsAndBoundedToGear) {
let pathParts = file.split(sep);
pathParts.some((pathPart, pathPartIdx) => {
@ -44,7 +44,7 @@ function rootDir (file, opts = {}) {
pathParts.slice(pathPartIdx + 1).join(sep)
;
fileGearPath = join(gearPath, fileGearPath)
fileGearPath = join(gearPath, fileGearPath);
fileExistsAndBoundedToGear =
fs.existsSync(fileGearPath) &&
@ -54,7 +54,7 @@ function rootDir (file, opts = {}) {
resolve(fileGearPath).startsWith(gearPath)
;
return fileExistsAndBoundedToGear
return fileExistsAndBoundedToGear;
});
}
@ -122,7 +122,6 @@ class GearResolverPlugin {
compiler.hooks.normalModuleFactory.tap(
'GearResolverPlugin',
nmf => {
nmf.hooks.afterResolve.tap('NormalModuleReplacementPlugin', result => {
if (!result) return;
return this._resolve(result, 'resource');

Loading…
Cancel
Save