-
Notifications
You must be signed in to change notification settings - Fork 443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User/Nav/Session Cleanup #1377
User/Nav/Session Cleanup #1377
Conversation
- updated user object boolean types - removed unused columns - added user object to session - add user object name.
Why is the "logoff / Poweroff" icon highlighted? Is that how you get to this side menu? |
@@ -608,21 +608,18 @@ | |||
<table name="user_usr" idMethod="native" phpName="User"> | |||
<column name="usr_per_ID" phpName="PersonId" type="SMALLINT" size="9" sqlType="mediumint(9) unsigned" primaryKey="true" required="true" defaultValue="0"/> | |||
<column name="usr_Password" phpName="Password" type="VARCHAR" size="500" required="true" defaultValue=""/> | |||
<column name="usr_NeedPasswordChange" phpName="NeedPasswordChange" type="TINYINT" size="3" sqlType="tinyint(3) unsigned" required="true" defaultValue="1"/> | |||
<column name="usr_NeedPasswordChange" phpName="NeedPasswordChange" type="BOOLEAN" size="3" sqlType="tinyint(3) unsigned" required="true" defaultValue="1"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Boolean size 3? What kind of parallel universe is this?! :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -554,7 +554,7 @@ function SendEmail($sSubject, $sMessage, $attachName, $hasAttach, $sRecipient) | |||
$sSubject = "Email job started at $tTimeStamp"; | |||
|
|||
$sMessage = "Email job issued by "; | |||
$sMessage .= $_SESSION['UserFirstName'].' '.$_SESSION['UserLastName']; | |||
$sMessage .= $_SESSION['user']->getName(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
/* @var $currentUser \ChurchCRM\User */ | ||
$currentUser = $_SESSION['user']; | ||
$currentUser->setSearchLimit(FilterInput($_GET["Number"],'int')); | ||
$currentUser->save(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
session_var_in_uri, url_parm_name, security_grp | ||
FROM menuconfig_mcf | ||
WHERE parent = '$menu' AND active=1 " . $security_matrix . " | ||
$query = "SELECT name, ismenu, content, uri, statustext, session_var, session_var_in_text, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we ORM this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MVP :) but Yes we can
Header_modals(); | ||
Header_body_scripts(); | ||
|
||
$loggedInUserPhoto = $sRootPath . "/api/persons/" . $_SESSION['iUserID'] . "/photo"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it make sense to have a getUserPhoto();
function for cleaner re-use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will help with page load time as there is another thread doing the lookup
$_SESSION['bFinance'] = $currentUser->isFinanceEnabled(); | ||
$_SESSION['bNotes'] = $currentUser->isNotesEnabled(); | ||
$_SESSION['bEditSelf'] = $currentUser->isEditSelfEnabled(); | ||
$_SESSION['bCanvasser'] = $currentUser->isCanvasserEnabled(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eventually I see us moving away from session variables specific to the permission.....but that's probably not for a while.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this cleanup for now.
@@ -134,28 +132,28 @@ | |||
|
|||
if ($undupCount == 0) { | |||
$sPasswordHashSha256 = hash ("sha256", $sDefault_Pass.$iPersonID); | |||
$sSQL = "INSERT INTO user_usr (usr_per_ID, usr_Password, usr_NeedPasswordChange, usr_LastLogin, usr_AddRecords, usr_EditRecords, usr_DeleteRecords, usr_MenuOptions, usr_ManageGroups, usr_Finance, usr_Notes, usr_Communication, usr_Admin, usr_Style, usr_SearchLimit, usr_defaultFY, usr_UserName, usr_EditSelf, usr_Canvasser) VALUES (" . $iPersonID . ",'" . $sPasswordHashSha256 . "',1,'" . date("Y-m-d H:i:s") . "', " . $AddRecords . ", " . $EditRecords . ", " . $DeleteRecords . ", " . $MenuOptions . ", " . $ManageGroups . ", " . $Finance . ", " . $Notes . ", " . $Communication . ", " . $Admin . ", '" . $Style . "', 10," . $defaultFY . ",\"" . $sUserName . "\"," . $EditSelf . "," . $Canvasser . ")"; | |||
$sSQL = "INSERT INTO user_usr (usr_per_ID, usr_Password, usr_NeedPasswordChange, usr_LastLogin, usr_AddRecords, usr_EditRecords, usr_DeleteRecords, usr_MenuOptions, usr_ManageGroups, usr_Finance, usr_Notes, usr_Admin, usr_Style, usr_SearchLimit, usr_defaultFY, usr_UserName, usr_EditSelf, usr_Canvasser) VALUES (" . $iPersonID . ",'" . $sPasswordHashSha256 . "',1,'" . date("Y-m-d H:i:s") . "', " . $AddRecords . ", " . $EditRecords . ", " . $DeleteRecords . ", " . $MenuOptions . ", " . $ManageGroups . ", " . $Finance . ", " . $Notes . ", " . $Admin . ", '" . $Style . "', 10," . $defaultFY . ",\"" . $sUserName . "\"," . $EditSelf . "," . $Canvasser . ")"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we can ORM this now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes I'll be working on user ORM in another branch
if ($undupCount == 0) { | ||
$sSQL = "UPDATE user_usr SET usr_AddRecords = " . $AddRecords . ", usr_EditRecords = " . $EditRecords . ", usr_DeleteRecords = " . $DeleteRecords . ", usr_MenuOptions = " . $MenuOptions . ", usr_ManageGroups = " . $ManageGroups . ", usr_Finance = " . $Finance . ", usr_Notes = " . $Notes . ", usr_Communication = " . $Communication . ", usr_Admin = " . $Admin . ", usr_Style = \"" . $Style . "\", usr_UserName = \"" . $sUserName . "\", usr_EditSelf = \"" . $EditSelf . "\", usr_Canvasser = " . $Canvasser . " WHERE usr_per_ID = " . $iPersonID; | ||
$sSQL = "UPDATE user_usr SET usr_AddRecords = " . $AddRecords . ", usr_EditRecords = " . $EditRecords . ", usr_DeleteRecords = " . $DeleteRecords . ", usr_MenuOptions = " . $MenuOptions . ", usr_ManageGroups = " . $ManageGroups . ", usr_Finance = " . $Finance . ", usr_Notes = " . $Notes . ", usr_Admin = " . $Admin . ", usr_Style = \"" . $Style . "\", usr_UserName = \"" . $sUserName . "\", usr_EditSelf = \"" . $EditSelf . "\", usr_Canvasser = " . $Canvasser . " WHERE usr_per_ID = " . $iPersonID; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ORM?
@@ -1242,30 +1238,27 @@ INSERT INTO `userconfig_ucfg` (`ucfg_per_id`, `ucfg_id`, `ucfg_name`, `ucfg_valu | |||
CREATE TABLE `user_usr` ( | |||
`usr_per_ID` mediumint(9) unsigned NOT NULL default '0', | |||
`usr_Password` varchar(500) NOT NULL default '', | |||
`usr_NeedPasswordChange` tinyint(3) unsigned NOT NULL default '1', | |||
`usr_NeedPasswordChange` tinyint(1) unsigned NOT NULL default '1', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You got it - 1 here - but 3 in schema.xml ;-)
`usr_SearchLimit` tinyint(4) default '10', | ||
`usr_Style` varchar(50) default 'Style.css', | ||
`usr_showPledges` tinyint(1) NOT NULL default '0', | ||
`usr_showPayments` tinyint(1) NOT NULL default '0', | ||
`usr_showSince` date NOT NULL default '0000-00-00', | ||
`usr_defaultFY` mediumint(9) NOT NULL default '10', | ||
`usr_currentDeposit` mediumint(9) NOT NULL default '0', | ||
`usr_UserName` varchar(32) default NULL, | ||
`usr_EditSelf` tinyint(3) unsigned NOT NULL default '0', | ||
`usr_UserName` varchar(50) default NULL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's 50 here, but only 32 in the schema.xml model definition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good find
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
ALTER TABLE `user_usr` | ||
CHANGE COLUMN `usr_NeedPasswordChange` `usr_NeedPasswordChange` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1' COMMENT '' , | ||
CHANGE COLUMN `usr_UserName` `usr_UserName` VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NOT NULL COMMENT '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's 50 here, but only 32 in the schema.xml model definition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
$.ajax({ | ||
url: window.CRM.root + "/api/timerjobs/run", | ||
type: "POST" | ||
}); | ||
$(".date-picker").datepicker({format:'yyyy-mm-dd', language: window.CRM.lang}); | ||
}); | ||
|
||
function showGlobalMessage(message, callOutClass) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmm......Interesting idea.
|
||
public function isCanvasserEnabled() | ||
{ | ||
return ($this->isAdmin() ? true : $this->isCanvasser()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd write all those as
return $this->isAdmin() || $this->isEditSelf();
rather than using the ternary ?: operator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
all 3 tags are used - Moved settings - moved admin menus - moved Properties menus - moved cvs export
need to move the following links to the Right Nav also |
closes #1112 #1315 #1378
started #947