Merge branch 'whmcs-login' into whmcs-login-saas
This commit is contained in:
commit
82220a44a3
|
@ -41,6 +41,7 @@ define('UI_MDATA_VALUE_FORMAT_STREAM' , 'live stream');
|
||||||
//User types
|
//User types
|
||||||
define('UTYPE_HOST' , 'H');
|
define('UTYPE_HOST' , 'H');
|
||||||
define('UTYPE_ADMIN' , 'A');
|
define('UTYPE_ADMIN' , 'A');
|
||||||
|
define('UTYPE_SUPERADMIN' , 'S');
|
||||||
define('UTYPE_GUEST' , 'G');
|
define('UTYPE_GUEST' , 'G');
|
||||||
define('UTYPE_PROGRAM_MANAGER' , 'P');
|
define('UTYPE_PROGRAM_MANAGER' , 'P');
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,9 @@ class UserController extends Zend_Controller_Action
|
||||||
$user->setPassword($formData['password']);
|
$user->setPassword($formData['password']);
|
||||||
}
|
}
|
||||||
if (array_key_exists('type', $formData)) {
|
if (array_key_exists('type', $formData)) {
|
||||||
$user->setType($formData['type']);
|
if ($formData['type'] != UTYPE_SUPERADMIN) { //Don't allow any other user to be promoted to Super Admin
|
||||||
|
$user->setType($formData['type']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$user->setEmail($formData['email']);
|
$user->setEmail($formData['email']);
|
||||||
$user->setCellPhone($formData['cell_phone']);
|
$user->setCellPhone($formData['cell_phone']);
|
||||||
|
@ -189,6 +191,12 @@ class UserController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = new Application_Model_User($delId);
|
$user = new Application_Model_User($delId);
|
||||||
|
|
||||||
|
// Don't allow super admins to be deleted.
|
||||||
|
if ($user->isSuperAdmin())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
# Take care of the user's files by either assigning them to somebody
|
# Take care of the user's files by either assigning them to somebody
|
||||||
# or deleting them all
|
# or deleting them all
|
||||||
|
|
|
@ -49,7 +49,12 @@ class Application_Model_User
|
||||||
{
|
{
|
||||||
return $this->isUserType(UTYPE_ADMIN);
|
return $this->isUserType(UTYPE_ADMIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isSuperAdmin()
|
||||||
|
{
|
||||||
|
return $this->isUserType(UTYPE_SUPERADMIN);
|
||||||
|
}
|
||||||
|
|
||||||
public function canSchedule($p_showId)
|
public function canSchedule($p_showId)
|
||||||
{
|
{
|
||||||
$type = $this->getType();
|
$type = $this->getType();
|
||||||
|
|
|
@ -157,7 +157,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</dd>
|
</dd>
|
||||||
<button type="submit" id="cu_save_user" class="btn btn-small right-floated"><?php echo _("Save")?></button>
|
|
||||||
</dl>
|
</dl>
|
||||||
|
<button type="submit" id="cu_save_user" class="btn btn-small right-floated"><?php echo _("Save")?></button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -26,6 +26,9 @@
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="user-data" id="user_details_superadmin_message" style="display: none; margin-top: 105px; text-align: center;">
|
||||||
|
<?=sprintf(_("Super Admin details can be changed in your <a href=\"%s\">Billing Settings</a>."), "/billing/client");?>
|
||||||
|
</div>
|
||||||
<div class="user-data simple-formblock" id="user_details">
|
<div class="user-data simple-formblock" id="user_details">
|
||||||
<?php echo $this->successMessage ?>
|
<?php echo $this->successMessage ?>
|
||||||
<fieldset class="padded">
|
<fieldset class="padded">
|
||||||
|
|
|
@ -4,6 +4,17 @@ function populateForm(entries){
|
||||||
$('.errors').remove();
|
$('.errors').remove();
|
||||||
$('.success').remove();
|
$('.success').remove();
|
||||||
|
|
||||||
|
if (entries.type === 'S')
|
||||||
|
{
|
||||||
|
$("#user_details").hide();
|
||||||
|
$("#user_details_superadmin_message").show();
|
||||||
|
$('#type').attr('disabled', '1');
|
||||||
|
} else {
|
||||||
|
$("#user_details").show();
|
||||||
|
$("#user_details_superadmin_message").hide();
|
||||||
|
$('#type').removeAttr('disabled');
|
||||||
|
}
|
||||||
|
|
||||||
$('#user_id').val(entries.id);
|
$('#user_id').val(entries.id);
|
||||||
$('#login').val(entries.login);
|
$('#login').val(entries.login);
|
||||||
$('#first_name').val(entries.first_name);
|
$('#first_name').val(entries.first_name);
|
||||||
|
@ -23,12 +34,6 @@ function populateForm(entries){
|
||||||
$('#password').val("");
|
$('#password').val("");
|
||||||
$('#passwordVerify').val("");
|
$('#passwordVerify').val("");
|
||||||
}
|
}
|
||||||
if (entries.login === 'admin')
|
|
||||||
{
|
|
||||||
$('#type').attr('disabled', '1');
|
|
||||||
} else {
|
|
||||||
$('#type').removeAttr('disabled');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function rowClickCallback(row_id){
|
function rowClickCallback(row_id){
|
||||||
|
@ -66,6 +71,7 @@ function rowCallback( nRow, aData, iDisplayIndex ){
|
||||||
} else if ( aData['type'] == "S" )
|
} else if ( aData['type'] == "S" )
|
||||||
{
|
{
|
||||||
$('td:eq(3)', nRow).html( $.i18n._('Super Admin') );
|
$('td:eq(3)', nRow).html( $.i18n._('Super Admin') );
|
||||||
|
$('td:eq(4)', nRow).html(""); //Disable deleting the super admin
|
||||||
}
|
}
|
||||||
|
|
||||||
return nRow;
|
return nRow;
|
||||||
|
|
Loading…
Reference in New Issue