mirror of
https://github.com/typemill/typemill.git
synced 2025-07-31 19:30:40 +02:00
Version 1.3.8: ACL Integration
This commit is contained in:
@@ -66,25 +66,37 @@ class User extends WriteYaml
|
||||
{
|
||||
$userdata = $this->getUser($params['username']);
|
||||
|
||||
# make sure passwords are not overwritten
|
||||
if(isset($params['newpassword'])){ unset($params['newpassword']); }
|
||||
if(isset($params['password']))
|
||||
{
|
||||
$params['password'] = $this->generatePassword($params['password']);
|
||||
if(empty($params['password']))
|
||||
{
|
||||
unset($params['password']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$params['password'] = $this->generatePassword($params['password']);
|
||||
}
|
||||
}
|
||||
|
||||
$update = array_merge($userdata, $params);
|
||||
|
||||
$this->updateYaml('settings/users', $userdata['username'] . '.yaml', $update);
|
||||
|
||||
$_SESSION['user'] = $update['username'];
|
||||
$_SESSION['role'] = $update['userrole'];
|
||||
# if user updated his own profile, update session data
|
||||
if($_SESSION['user'] == $params['username'])
|
||||
{
|
||||
$_SESSION['role'] = $update['userrole'];
|
||||
|
||||
if(isset($update['firstname']))
|
||||
{
|
||||
$_SESSION['firstname'] = $update['firstname'];
|
||||
}
|
||||
if(isset($update['lastname']))
|
||||
{
|
||||
$_SESSION['lastname'] = $update['lastname'];
|
||||
if(isset($update['firstname']))
|
||||
{
|
||||
$_SESSION['firstname'] = $update['firstname'];
|
||||
}
|
||||
if(isset($update['lastname']))
|
||||
{
|
||||
$_SESSION['lastname'] = $update['lastname'];
|
||||
}
|
||||
}
|
||||
|
||||
return $userdata['username'];
|
||||
|
@@ -52,11 +52,18 @@ class WriteMeta extends WriteYaml
|
||||
|
||||
$description = $this->generateDescription($content, $parsedown, $item);
|
||||
|
||||
# owner holds the edit-rights
|
||||
$owner = '';
|
||||
if(isset($_SESSION['user']))
|
||||
{
|
||||
$owner = $_SESSION['user'];
|
||||
}
|
||||
|
||||
$author = $settings['author'];
|
||||
|
||||
if(isset($_SESSION))
|
||||
{
|
||||
if(isset($_SESSION['firstname']) && $_SESSION['firstname'] !='' && isset($_SESSION['lastname']) && $_SESSION['lastname'] != '')
|
||||
if(isset($_SESSION['firstname']) && $_SESSION['firstname'] != '' && isset($_SESSION['lastname']) && $_SESSION['lastname'] != '')
|
||||
{
|
||||
$author = $_SESSION['firstname'] . ' ' . $_SESSION['lastname'];
|
||||
}
|
||||
@@ -71,6 +78,7 @@ class WriteMeta extends WriteYaml
|
||||
'meta' => [
|
||||
'title' => $title,
|
||||
'description' => $description,
|
||||
'owner' => $owner,
|
||||
'author' => $author,
|
||||
'created' => date("Y-m-d"),
|
||||
'time' => date("H-i-s"),
|
||||
@@ -88,6 +96,13 @@ class WriteMeta extends WriteYaml
|
||||
# used by MetaApiController. Do not set title or description in defaults if page is not published yet
|
||||
public function getPageMetaBlank($content, $settings, $item)
|
||||
{
|
||||
# owner holds the edit-rights
|
||||
$owner = '';
|
||||
if(isset($_SESSION['user']))
|
||||
{
|
||||
$owner = $_SESSION['user'];
|
||||
}
|
||||
|
||||
$author = $settings['author'];
|
||||
|
||||
if(isset($_SESSION))
|
||||
@@ -107,6 +122,7 @@ class WriteMeta extends WriteYaml
|
||||
'meta' => [
|
||||
'title' => '',
|
||||
'description' => '',
|
||||
'owner' => $owner,
|
||||
'author' => $author,
|
||||
'created' => date("Y-m-d"),
|
||||
'time' => date("H-i-s"),
|
||||
|
Reference in New Issue
Block a user