Commit 33c0f73b authored by m.stenta's avatar m.stenta
Browse files

Issue #2973820: Provide access callback for log properties

parent 0df71da5
...@@ -255,7 +255,7 @@ function log_entity_property_info_alter(&$info) { ...@@ -255,7 +255,7 @@ function log_entity_property_info_alter(&$info) {
'type' => 'token', 'type' => 'token',
'description' => t('The type of the log.'), 'description' => t('The type of the log.'),
'setter callback' => 'entity_property_verbatim_set', 'setter callback' => 'entity_property_verbatim_set',
'setter permission' => 'administer log module', 'access callback' => 'log_properties_access',
'options list' => 'log_type_get_names', 'options list' => 'log_type_get_names',
'required' => TRUE, 'required' => TRUE,
'schema field' => 'type', 'schema field' => 'type',
...@@ -265,7 +265,7 @@ function log_entity_property_info_alter(&$info) { ...@@ -265,7 +265,7 @@ function log_entity_property_info_alter(&$info) {
'type' => 'user', 'type' => 'user',
'description' => t('The author of the log.'), 'description' => t('The author of the log.'),
'setter callback' => 'entity_property_verbatim_set', 'setter callback' => 'entity_property_verbatim_set',
'setter permission' => 'administer log module', 'access callback' => 'log_properties_access',
'required' => TRUE, 'required' => TRUE,
'schema field' => 'uid', 'schema field' => 'uid',
); );
...@@ -274,7 +274,7 @@ function log_entity_property_info_alter(&$info) { ...@@ -274,7 +274,7 @@ function log_entity_property_info_alter(&$info) {
'type' => 'date', 'type' => 'date',
'description' => t('The timestamp of the event being logged.'), 'description' => t('The timestamp of the event being logged.'),
'setter callback' => 'entity_property_verbatim_set', 'setter callback' => 'entity_property_verbatim_set',
'setter permission' => 'administer log module', 'access callback' => 'log_properties_access',
'required' => TRUE, 'required' => TRUE,
'schema field' => 'timestamp', 'schema field' => 'timestamp',
); );
...@@ -283,7 +283,7 @@ function log_entity_property_info_alter(&$info) { ...@@ -283,7 +283,7 @@ function log_entity_property_info_alter(&$info) {
'type' => 'date', 'type' => 'date',
'description' => t('The timestamp when the log entity was created.'), 'description' => t('The timestamp when the log entity was created.'),
'setter callback' => 'entity_property_verbatim_set', 'setter callback' => 'entity_property_verbatim_set',
'setter permission' => 'administer log module', 'access callback' => 'log_properties_access',
'required' => TRUE, 'required' => TRUE,
'schema field' => 'created', 'schema field' => 'created',
); );
...@@ -292,7 +292,7 @@ function log_entity_property_info_alter(&$info) { ...@@ -292,7 +292,7 @@ function log_entity_property_info_alter(&$info) {
'type' => 'date', 'type' => 'date',
'description' => t('The timestamp when the log entity was last modified.'), 'description' => t('The timestamp when the log entity was last modified.'),
'setter callback' => 'entity_property_verbatim_set', 'setter callback' => 'entity_property_verbatim_set',
'setter permission' => 'administer log module', 'access callback' => 'log_properties_access',
'required' => TRUE, 'required' => TRUE,
'schema field' => 'changed', 'schema field' => 'changed',
); );
...@@ -300,7 +300,7 @@ function log_entity_property_info_alter(&$info) { ...@@ -300,7 +300,7 @@ function log_entity_property_info_alter(&$info) {
'label' => t('Done'), 'label' => t('Done'),
'description' => t('Whether the log is done.'), 'description' => t('Whether the log is done.'),
'setter callback' => 'entity_property_verbatim_set', 'setter callback' => 'entity_property_verbatim_set',
'setter permission' => 'administer log module', 'access callback' => 'log_properties_access',
'schema field' => 'done', 'schema field' => 'done',
'type' => 'boolean', 'type' => 'boolean',
); );
...@@ -867,6 +867,23 @@ function log_type_access($op, $log = NULL) { ...@@ -867,6 +867,23 @@ function log_type_access($op, $log = NULL) {
return user_access('administer log types'); return user_access('administer log types');
} }
/**
* Access callback for log properties.
*/
function log_properties_access($op, $property, $entity = NULL, $account = NULL) {
// Delegate to the general log access callback, based on the $op.
switch ($op) {
case 'view':
return log_access('view', $entity, $account);
case 'edit':
return log_access('update', $entity, $account);
}
// Otherwise, deny access.
return FALSE;
}
/*************************************************************** /***************************************************************
* Log API functions * Log API functions
* *************************************************************/ * *************************************************************/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment