Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
1a43b4ed
Commit
1a43b4ed
authored
Nov 12, 2013
by
Son Nguyen
Committed by
Gerrit Code Review
Nov 12, 2013
Browse files
Merge "Elasticsearch not finding unattached group artefacts (bug #1237177)"
parents
954c08d4
4d7e5861
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/search/elasticsearch/type/ElasticsearchType_artefact.php
View file @
1a43b4ed
...
...
@@ -188,6 +188,15 @@ class ElasticsearchType_artefact extends ElasticsearchType
// Access: get all the views where the artefact is included
$access
=
self
::
view_access_records
(
$id
);
$accessObj
=
self
::
access_process
(
$access
);
if
(
!
$access
)
{
// File access: get viewable group media not attached to a view
$groupaccess
=
self
::
group_artefact_access_records
(
$id
);
if
(
$groupaccess
)
{
foreach
(
$groupaccess
as
$access
)
{
$accessObj
[
'groups'
][
$access
->
role
][]
=
$access
->
can_view
;
}
}
}
$record
->
access
=
$accessObj
;
// set 'mainfacetterm' & 'artefactgroup'
...
...
@@ -366,6 +375,18 @@ class ElasticsearchType_artefact extends ElasticsearchType
return
$records
;
}
/**
* Get all access records of the group artefacts (called if not attached to view)
*/
public
static
function
group_artefact_access_records
(
$artefactid
)
{
$records
=
get_records_sql_array
(
'
SELECT role, can_view FROM {artefact_access_role} WHERE artefact = ?
'
,
array
(
$artefactid
)
);
return
$records
;
}
/**
* Get views linked to a particular artefact, applying ACL
* This is used to display the list of views in an artefact result, because it's faster to retrieve the info
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment