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
b934beec
Verified
Commit
b934beec
authored
5 years ago
by
Damien
Browse files
Options
Downloads
Patches
Plain Diff
FEAT #11266 TIME 2:00 Get indexing informations
parent
3cec5272
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
rest/index.php
+1
-0
1 addition, 0 deletions
rest/index.php
sql/develop.sql
+6
-0
6 additions, 0 deletions
sql/develop.sql
src/app/group/controllers/GroupController.php
+48
-1
48 additions, 1 deletion
src/app/group/controllers/GroupController.php
with
55 additions
and
1 deletion
rest/index.php
+
1
−
0
View file @
b934beec
...
...
@@ -179,6 +179,7 @@ $app->get('/groups/{id}', \Group\controllers\GroupController::class . ':getById'
$app
->
put
(
'/groups/{id}'
,
\Group\controllers\GroupController
::
class
.
':update'
);
$app
->
delete
(
'/groups/{id}'
,
\Group\controllers\GroupController
::
class
.
':delete'
);
$app
->
get
(
'/groups/{id}/details'
,
\Group\controllers\GroupController
::
class
.
':getDetailledById'
);
$app
->
get
(
'/groups/{id}/indexing'
,
\Group\controllers\GroupController
::
class
.
':getIndexingDetailsById'
);
$app
->
put
(
'/groups/{id}/services/{serviceId}'
,
\Group\controllers\GroupController
::
class
.
':updateService'
);
$app
->
put
(
'/groups/{id}/reassign/{newGroupId}'
,
\Group\controllers\GroupController
::
class
.
':reassignUsers'
);
...
...
This diff is collapsed.
Click to expand it.
sql/develop.sql
+
6
−
0
View file @
b934beec
...
...
@@ -32,6 +32,12 @@ UPDATE res_attachments SET fulltext_result = 'ERROR' WHERE fulltext_result = '-1
UPDATE
res_version_attachments
SET
fulltext_result
=
'SUCCESS'
WHERE
fulltext_result
=
'1'
OR
fulltext_result
=
'2'
;
UPDATE
res_version_attachments
SET
fulltext_result
=
'ERROR'
WHERE
fulltext_result
=
'-1'
OR
fulltext_result
=
'-2'
;
/* GROUPS INDEXING */
ALTER
TABLE
usergroups
DROP
COLUMN
IF
EXISTS
can_index
;
ALTER
TABLE
usergroups
ADD
COLUMN
can_index
boolean
NOT
NULL
DEFAULT
FALSE
;
ALTER
TABLE
usergroups
DROP
COLUMN
IF
EXISTS
indexation_parameters
;
ALTER
TABLE
usergroups
ADD
COLUMN
indexation_parameters
jsonb
NOT
NULL
DEFAULT
'{"actions" : {}, "entities" : [], "keywords" : []}'
;
/* REFACTORING */
ALTER
TABLE
res_letterbox
DROP
COLUMN
IF
EXISTS
converter_result
;
...
...
This diff is collapsed.
Click to expand it.
src/app/group/controllers/GroupController.php
+
48
−
1
View file @
b934beec
...
...
@@ -2,7 +2,9 @@
namespace
Group\controllers
;
use
Action\models\ActionModel
;
use
Basket\models\GroupBasketModel
;
use
Entity\models\EntityModel
;
use
Group\models\ServiceModel
;
use
Group\models\GroupModel
;
use
Respect\Validation\Validator
;
...
...
@@ -130,7 +132,7 @@ class GroupController
return
$response
->
withStatus
(
403
)
->
withJson
([
'errors'
=>
'Service forbidden'
]);
}
$group
=
GroupModel
::
getById
([
'id'
=>
$aArgs
[
'id'
]]);
$group
=
GroupModel
::
getById
([
'id'
=>
$aArgs
[
'id'
]
,
'select'
=>
[
'id'
,
'group_id'
,
'group_desc'
,
'enabled'
]
]);
if
(
empty
(
$group
))
{
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'Group not found'
]);
}
...
...
@@ -205,6 +207,51 @@ class GroupController
return
$response
->
withJson
([
'success'
=>
'success'
]);
}
public
function
getIndexingDetailsById
(
Request
$request
,
Response
$response
,
array
$args
)
{
if
(
!
ServiceModel
::
hasService
([
'id'
=>
'admin_groups'
,
'userId'
=>
$GLOBALS
[
'userId'
],
'location'
=>
'apps'
,
'type'
=>
'admin'
]))
{
return
$response
->
withStatus
(
403
)
->
withJson
([
'errors'
=>
'Service forbidden'
]);
}
$group
=
GroupModel
::
getById
([
'id'
=>
$args
[
'id'
],
'select'
=>
[
'can_index'
,
'indexation_parameters'
]]);
if
(
empty
(
$group
))
{
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'Group not found'
]);
}
$group
[
'indexation_parameters'
]
=
json_decode
(
$group
[
'indexation_parameters'
],
true
);
$allActions
=
ActionModel
::
get
([
'select'
=>
[
'id'
,
'label_action'
],
'where'
=>
[
'component in (?)'
],
'data'
=>
[[
'confirmAction'
,
'closeMailAction'
]]]);
$allEntities
=
EntityModel
::
get
([
'select'
=>
[
'e1.id'
,
'e1.entity_id'
,
'e1.entity_label'
,
'e2.id as parent_id'
],
'table'
=>
[
'entities e1'
,
'entities e2'
],
'left_join'
=>
[
'e1.parent_entity_id = e2.entity_id'
],
'where'
=>
[
'e1.enabled = ?'
],
'data'
=>
[
'Y'
]
]);
foreach
(
$allEntities
as
$key
=>
$value
)
{
$allEntities
[
$key
][
'id'
]
=
$value
[
'id'
];
if
(
empty
(
$value
[
'parent_id'
]))
{
$allEntities
[
$key
][
'parent'
]
=
'#'
;
$allEntities
[
$key
][
'icon'
]
=
"fa fa-building"
;
}
else
{
$allEntities
[
$key
][
'parent'
]
=
$value
[
'parent_id'
];
$allEntities
[
$key
][
'icon'
]
=
"fa fa-sitemap"
;
}
$allEntities
[
$key
][
'state'
][
'opened'
]
=
false
;
$allEntities
[
$key
][
'allowed'
]
=
true
;
if
(
in_array
(
$value
[
'id'
],
$group
[
'indexation_parameters'
][
'entities'
]))
{
$allEntities
[
$key
][
'state'
][
'opened'
]
=
true
;
$allEntities
[
$key
][
'state'
][
'selected'
]
=
true
;
}
$allEntities
[
$key
][
'text'
]
=
$value
[
'entity_label'
];
}
return
$response
->
withJson
([
'group'
=>
$group
,
'actions'
=>
$allActions
,
'entities'
=>
$allEntities
]);
}
public
static
function
getGroupsClause
(
array
$aArgs
)
{
ValidatorModel
::
notEmpty
(
$aArgs
,
[
'userId'
]);
...
...
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