Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MaarchCourrier
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Harbor Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maarch
MaarchCourrier
Commits
7a56c1b2
Commit
7a56c1b2
authored
8 years ago
by
Alex ORLUC
Browse files
Options
Downloads
Patches
Plain Diff
FIX #5234 fix entities perimeter list
parent
e14af961
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/tags/class/TagControler_Abstract.php
+54
-6
54 additions, 6 deletions
modules/tags/class/TagControler_Abstract.php
modules/tags/tags_update.php
+7
-5
7 additions, 5 deletions
modules/tags/tags_update.php
with
61 additions
and
11 deletions
modules/tags/class/TagControler_Abstract.php
+
54
−
6
View file @
7a56c1b2
...
...
@@ -46,6 +46,7 @@ try {
require_once
(
"modules/tags/tags_tables_definition.php"
);
require_once
(
"core/class/users_controler.php"
);
require_once
(
"modules/entities/class/class_users_entities_Abstract.php"
);
require_once
(
"core/class/users_controler.php"
);
}
catch
(
Exception
$e
){
functions
::
xecho
(
$e
->
getMessage
())
.
' // '
;
...
...
@@ -80,12 +81,11 @@ abstract class tag_controler_Abstract extends ObjectControler
if
(
$core
->
test_service
(
'private_tag'
,
'tags'
,
false
)
==
1
){
$entitiesRestriction
=
array
();
$
e
ntities
Direction
=
users_controler
::
get
Parent
Entities
WithType
(
$_SESSION
[
'user'
][
'UserId'
]
,
'Direction'
);
$
userE
ntities
=
users_controler
::
getEntities
(
$_SESSION
[
'user'
][
'UserId'
]);
//var_dump($entitiesDirection);
foreach
(
$entitiesDirection
as
$entity_id
)
{
foreach
(
$userEntities
as
$entity
)
{
$entity_id
=
$entity
[
'ENTITY_ID'
];
$entitiesRestriction
[]
=
$entity_id
;
$tmp_arr
=
users_entities_Abstract
::
getEntityChildren
(
$entity_id
);
$entitiesRestriction
=
array_merge
(
$entitiesRestriction
,
$tmp_arr
);
}
//var_dump($entitiesRestriction);
//CHECK TAG IS ALLOW FOR THESE ENTITIES
...
...
@@ -134,7 +134,6 @@ abstract class tag_controler_Abstract extends ObjectControler
$stmt
=
$db
->
query
(
'SELECT tag_id, tag_label FROM '
.
_TAG_TABLE_NAME
.
$whereClause
.
' ORDER BY tag_label ASC '
,
$where_what
);
}
...
...
@@ -343,9 +342,58 @@ abstract class tag_controler_Abstract extends ObjectControler
* @If tag exists, return this value, else, return false
*/
$db
=
new
Database
();
$core
=
new
core_tools
();
$where
=
''
;
if
(
$core
->
test_service
(
'private_tag'
,
'tags'
,
false
)
==
1
){
$entitiesRestriction
=
array
();
$userEntities
=
users_controler
::
getEntities
(
$_SESSION
[
'user'
][
'UserId'
]);
//var_dump($entitiesDirection);
foreach
(
$userEntities
as
$entity
)
{
$entity_id
=
$entity
[
'ENTITY_ID'
];
$entitiesRestriction
[]
=
$entity_id
;
}
//var_dump($entitiesRestriction);
//CHECK TAG IS ALLOW FOR THESE ENTITIES
if
(
!
empty
(
$entitiesRestriction
)){
$entitiesRestriction
=
"'"
.
implode
(
"','"
,
$entitiesRestriction
)
.
"'"
;
$where
=
' WHERE entity_id IN ('
.
$entitiesRestriction
.
')'
;
}
else
{
$where
=
''
;
}
$stmt
=
$db
->
query
(
'SELECT distinct(tag_id)'
.
' FROM tags_entities'
.
$where
,
array
());
$restrictedTagIdList
=
$stmt
->
fetchAll
(
PDO
::
FETCH_COLUMN
,
0
);
//var_dump($restrictedTagIdList);
//CHECK TAG WHO IS NOT RESTRICTED
$stmt
=
$db
->
query
(
'SELECT tag_id'
.
' FROM tags'
.
' WHERE tag_id NOT IN (select distinct(tag_id) from tags_entities)'
,
array
());
$freeTagIdList
=
$stmt
->
fetchAll
(
PDO
::
FETCH_COLUMN
,
0
);
//var_dump($freeTagIdList);
//MERGE ALLOWED TAGS AND FREE TAGS
$tagIdList
=
array_merge
(
$restrictedTagIdList
,
$freeTagIdList
);
if
(
!
empty
(
$tagIdList
)){
$tagIdList
=
"'"
.
implode
(
"','"
,
$tagIdList
)
.
"'"
;
$where
=
' AND tag_id IN ('
.
$tagIdList
.
')'
;
}
else
{
$where
=
''
;
}
}
$stmt
=
$db
->
query
(
"DELETE FROM tag_res"
.
" WHERE res_id = ?"
.
$where
,
array
(
$res_id
));
/*$hist = new history();
$hist->add(
...
...
@@ -480,7 +528,7 @@ abstract class tag_controler_Abstract extends ObjectControler
.
" WHERE tag_id = ?"
,
array
(
$new_tag_label
,
$tag_id
));
//reset entities restrictions
//reset entities restrictions
$stmt
=
$db
->
query
(
"DELETE FROM tags_entities"
.
" WHERE tag_id = ?"
...
...
This diff is collapsed.
Click to expand it.
modules/tags/tags_update.php
+
7
−
5
View file @
7a56c1b2
...
...
@@ -62,12 +62,14 @@ elseif($coll_id){
include_once
'modules/tags/route.php'
;
if
(
!
empty
(
$tags
))
if
(
empty
(
$tags
_list
))
{
$tags
=
new
tag_controler
();
$tagmodule_result
=
$tags
->
associateTagToRes
(
$ressource_tagmodule
,
$collection_tagmodule
,
$tags_list
);
unset
(
$_SESSION
[
'tagsuser'
]);
$tags_list
=
array
();
}
$tags
=
new
tag_controler
();
$tagmodule_result
=
$tags
->
associateTagToRes
(
$ressource_tagmodule
,
$collection_tagmodule
,
$tags_list
);
unset
(
$_SESSION
[
'tagsuser'
]);
?>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment