Add extra seat check in the user API call and turn off user->org conversion when authentication is LDAP
This commit is contained in:
parent
7ed3c603ec
commit
69be86be97
5 changed files with 17 additions and 9 deletions
|
@ -18,7 +18,7 @@ def build_requests_session():
|
||||||
# values are set to the frontend, DO NOT PLACE ANY SECRETS OR KEYS in this list.
|
# values are set to the frontend, DO NOT PLACE ANY SECRETS OR KEYS in this list.
|
||||||
CLIENT_WHITELIST = ['SERVER_HOSTNAME', 'PREFERRED_URL_SCHEME', 'GITHUB_CLIENT_ID',
|
CLIENT_WHITELIST = ['SERVER_HOSTNAME', 'PREFERRED_URL_SCHEME', 'GITHUB_CLIENT_ID',
|
||||||
'GITHUB_LOGIN_CLIENT_ID', 'MIXPANEL_KEY', 'STRIPE_PUBLISHABLE_KEY',
|
'GITHUB_LOGIN_CLIENT_ID', 'MIXPANEL_KEY', 'STRIPE_PUBLISHABLE_KEY',
|
||||||
'ENTERPRISE_LOGO_URL', 'SENTRY_PUBLIC_DSN']
|
'ENTERPRISE_LOGO_URL', 'SENTRY_PUBLIC_DSN', 'AUTHENTICATION_TYPE']
|
||||||
|
|
||||||
|
|
||||||
def getFrontendVisibleConfig(config_dict):
|
def getFrontendVisibleConfig(config_dict):
|
||||||
|
|
|
@ -229,7 +229,12 @@ def conduct_signin(username_or_email, password):
|
||||||
needs_email_verification = False
|
needs_email_verification = False
|
||||||
invalid_credentials = False
|
invalid_credentials = False
|
||||||
|
|
||||||
|
verified = None
|
||||||
|
try:
|
||||||
verified = authentication.verify_user(username_or_email, password)
|
verified = authentication.verify_user(username_or_email, password)
|
||||||
|
except model.TooManyUsersException as ex:
|
||||||
|
raise license_error(exception=ex)
|
||||||
|
|
||||||
if verified:
|
if verified:
|
||||||
if common_login(verified):
|
if common_login(verified):
|
||||||
return {'success': True}
|
return {'success': True}
|
||||||
|
@ -247,6 +252,7 @@ def conduct_signin(username_or_email, password):
|
||||||
|
|
||||||
@resource('/v1/user/convert')
|
@resource('/v1/user/convert')
|
||||||
@internal_only
|
@internal_only
|
||||||
|
@show_if(app.config['AUTHENTICATION_TYPE'] == 'Database')
|
||||||
class ConvertToOrganization(ApiResource):
|
class ConvertToOrganization(ApiResource):
|
||||||
""" Operations for converting a user to an organization. """
|
""" Operations for converting a user to an organization. """
|
||||||
schemas = {
|
schemas = {
|
||||||
|
|
|
@ -1589,7 +1589,7 @@ function RepoAdminCtrl($scope, Restangular, ApiService, KeyService, $routeParams
|
||||||
}
|
}
|
||||||
|
|
||||||
function UserAdminCtrl($scope, $timeout, $location, ApiService, PlanService, UserService, CookieService, KeyService,
|
function UserAdminCtrl($scope, $timeout, $location, ApiService, PlanService, UserService, CookieService, KeyService,
|
||||||
$routeParams, $http, UIService, Features) {
|
$routeParams, $http, UIService, Features, Config) {
|
||||||
$scope.Features = Features;
|
$scope.Features = Features;
|
||||||
|
|
||||||
if ($routeParams['migrate']) {
|
if ($routeParams['migrate']) {
|
||||||
|
@ -1597,11 +1597,9 @@ function UserAdminCtrl($scope, $timeout, $location, ApiService, PlanService, Use
|
||||||
}
|
}
|
||||||
|
|
||||||
UserService.updateUserIn($scope, function(user) {
|
UserService.updateUserIn($scope, function(user) {
|
||||||
if (!Features.GITHUB_LOGIN) { return; }
|
|
||||||
|
|
||||||
$scope.cuser = jQuery.extend({}, user);
|
$scope.cuser = jQuery.extend({}, user);
|
||||||
|
|
||||||
if ($scope.cuser.logins) {
|
if (Features.GITHUB_LOGIN && $scope.cuser.logins) {
|
||||||
for (var i = 0; i < $scope.cuser.logins.length; i++) {
|
for (var i = 0; i < $scope.cuser.logins.length; i++) {
|
||||||
if ($scope.cuser.logins[i].service == 'github') {
|
if ($scope.cuser.logins[i].service == 'github') {
|
||||||
var githubId = $scope.cuser.logins[i].service_identifier;
|
var githubId = $scope.cuser.logins[i].service_identifier;
|
||||||
|
@ -1694,6 +1692,8 @@ function UserAdminCtrl($scope, $timeout, $location, ApiService, PlanService, Use
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.reallyConvert = function() {
|
$scope.reallyConvert = function() {
|
||||||
|
if (Config.AUTHENTICATION_TYPE != 'Database') { return; }
|
||||||
|
|
||||||
$scope.loading = true;
|
$scope.loading = true;
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
Create New Organization
|
Create New Organization
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
<a href="/user/?migrate" ng-show="!user.anonymous" data-title="Starts the process to convert this account into an organization" bs-tooltip="tooltip.title">
|
<a href="/user/?migrate" data-title="Starts the process to convert this account into an organization" bs-tooltip="tooltip.title" quay-show="Config.AUTHENTICATION_TYPE == 'Database' && !user.anonymous">
|
||||||
<button class="btn btn-primary">
|
<button class="btn btn-primary">
|
||||||
<i class="fa fa-caret-square-o-right"></i>
|
<i class="fa fa-caret-square-o-right"></i>
|
||||||
Convert account
|
Convert account
|
||||||
|
|
|
@ -38,7 +38,9 @@
|
||||||
<li quay-show="Features.USER_LOG_ACCESS || hasPaidBusinessPlan">
|
<li quay-show="Features.USER_LOG_ACCESS || hasPaidBusinessPlan">
|
||||||
<a href="javascript:void(0)" data-toggle="tab" data-target="#logs" ng-click="loadLogs()">Usage Logs</a>
|
<a href="javascript:void(0)" data-toggle="tab" data-target="#logs" ng-click="loadLogs()">Usage Logs</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="javascript:void(0)" data-toggle="tab" data-target="#migrate" id="migrateTab">Convert to Organization</a></li>
|
<li quay-show="Config.AUTHENTICATION_TYPE == 'Database'">
|
||||||
|
<a href="javascript:void(0)" data-toggle="tab" data-target="#migrate" id="migrateTab">Convert to Organization</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -197,7 +199,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Convert to organization tab -->
|
<!-- Convert to organization tab -->
|
||||||
<div id="migrate" class="tab-pane">
|
<div id="migrate" class="tab-pane" quay-show="Config.AUTHENTICATION_TYPE == 'Database'">
|
||||||
<!-- Step 0 -->
|
<!-- Step 0 -->
|
||||||
<div class="panel" ng-show="convertStep == 0">
|
<div class="panel" ng-show="convertStep == 0">
|
||||||
<div class="panel-body" ng-show="user.organizations.length > 0">
|
<div class="panel-body" ng-show="user.organizations.length > 0">
|
||||||
|
|
Reference in a new issue