Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
support-app
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open-source
support-app
Commits
a65c34d7
Commit
a65c34d7
authored
Jul 5, 2024
by
Jean-Philippe Metivier
Browse files
Options
Downloads
Patches
Plain Diff
UP
parent
1ace1c64
No related branches found
No related tags found
No related merge requests found
Pipeline
#29658
failed
Jul 5, 2024
Stage: publish
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
config/autoload/unicaen-privilege.global.php
+83
-0
83 additions, 0 deletions
config/autoload/unicaen-privilege.global.php
module/Application/view/application/application/index.phtml
+76
-6
76 additions, 6 deletions
module/Application/view/application/application/index.phtml
with
159 additions
and
6 deletions
config/autoload/unicaen-privilege.global.php
0 → 100644
+
83
−
0
View file @
a65c34d7
<?php
use
UnicaenPrivilege\Entity\Db\Privilege
;
use
UnicaenPrivilege\Provider\Privilege\PrivilegePrivileges
;
use
UnicaenPrivilege\Provider\Rule\PrivilegeRuleProvider
;
use
UnicaenPrivilege\Service\Privilege\PrivilegeService
;
use
UnicaenUtilisateur\Entity\Db\Role
;
use
UnicaenUtilisateur\Provider\Privilege\RolePrivileges
;
$settings
=
[
/**
* L'entité associée aux roles peut être spécifiée via la clef de configuration ['unicaen_auth']['role_entity_class']
* si elle est manquante alors la classe \UnicaenUtiliseur\Entity\Db\Role est utilisée
* NB: la classe spécifiée doit hériter de \UnicaenUtiliseur\Entity\Db\AbstractRole.
*/
'unicaen-auth'
=>
[
'enable_privileges'
=>
true
,
'identity_providers'
=>
[
300
=>
'UnicaenAuthentification\Provider\Identity\Basic'
,
// en 1er
200
=>
'UnicaenAuthentification\Provider\Identity\Db'
,
// en 2e
100
=>
'UnicaenAuthentification\Provider\Identity\Ldap'
,
// en 3e @deprecated
// 020 => 'Application\Provider\IdentityProvider', // en 3e
],
],
'navigation'
=>
[
'default'
=>
[
'home'
=>
[
'pages'
=>
[
'administration'
=>
[
'pages'
=>
[
[
'label'
=>
"Privilèges"
,
'title'
=>
"Gérer les privilèges"
,
'route'
=>
'unicaen-privilege'
,
'resource'
=>
RolePrivileges
::
getResourceId
(
PrivilegePrivileges
::
PRIVILEGE_VOIR
),
'order'
=>
20050
,
'icon'
=>
'fas fa-angle-right'
,
],
],
],
],
],
],
],
];
if
(
$settings
[
'unicaen-auth'
][
'enable_privileges'
])
{
$privileges
=
[
'unicaen-auth'
=>
[
/**
* Classes représentant les entités rôle et privilège.
* - Entité rôle : héritant de \UnicaenAuth\Entity\Db\AbstractRole ou implémentant \UnicaenAuth\Entity\Db\RoleInterface.
* - Entité privilège : héritant de \UnicaenAuth\Entity\Db\AbstractPrivilege ou implémentant \UnicaenAuth\Entity\Db\PrivilegeInterface.
*
* Valeurs par défaut :
* - 'role_entity_class' : 'UnicaenAuth\Entity\Db\Role'
* - 'privilege_entity_class' : 'UnicaenAuth\Entity\Db\Privilege'
*/
'role_entity_class'
=>
Role
::
class
,
'privilege_entity_class'
=>
Privilege
::
class
,
],
'bjyauthorize'
=>
[
'resource_providers'
=>
[
/**
* Le service Privilèges peut aussi être une source de ressources,
* si on souhaite tester directement l'accès à un privilège
*/
PrivilegeService
::
class
=>
[],
],
'rule_providers'
=>
[
PrivilegeRuleProvider
::
class
=>
[],
],
],
];
}
else
{
$privileges
=
[];
}
return
array_merge_recursive
(
$settings
,
$privileges
);
\ No newline at end of file
This diff is collapsed.
Click to expand it.
module/Application/view/application/application/index.phtml
+
76
−
6
View file @
a65c34d7
...
...
@@ -18,15 +18,29 @@ $canApplicationModifier = $this->isAllowed(ApplicationPrivileges::getResourceId(
$canApplicationHistoriser
=
$this
->
isAllowed
(
ApplicationPrivileges
::
getResourceId
(
ApplicationPrivileges
::
APPLICATION_HISTORISER
));
$canApplicationSupprimer
=
$this
->
isAllowed
(
ApplicationPrivileges
::
getResourceId
(
ApplicationPrivileges
::
APPLICATION_SUPPRIMER
));
var_dump
(
new
DateTime
());
var_dump
(
$canApplicationAfficher
);
$this
->
headTitle
(
'Application'
);
?>
<br>
<div
class=
"row"
>
<div
class=
"col-md-8"
>
<h1
class=
"page-header"
>
Application
</h1>
</div>
<?php
if
(
$canApplicationAjouter
)
:
?>
<div
class=
"col-md-4"
>
<div
class=
"float-end"
>
<?php
/** @see \Application\Controller\ApplicationController::ajouterAction() */
?>
<a
href=
"
<?php
echo
$this
->
url
(
'application/ajouter'
,
[],
[],
true
);
?>
"
class=
"btn btn-primary ajax-modal"
data-event=
"modification"
>
<span
class=
"icon icon-ajouter"
></span>
Ajouter une application
</a>
</div>
</div>
<?php
endif
;
?>
</div>
<table
class=
"table table-condensed datatable"
>
<thead>
...
...
@@ -76,14 +90,70 @@ $this->headTitle('Application');
</td>
<td
class=
"action"
>
<?php
if
(
$canApplicationAfficher
)
:
?>
<?php
/** @see \Application\Controller\ApplicationController::afficherAction() */
?>
<a
href=
"
<?php
echo
$this
->
url
(
'application/afficher'
,
[
'application'
=>
$application
->
getId
()],
[],
true
);
?>
"
class=
"ajax-modal"
>
<span
class=
"icon icon-voir"
></span>
Afficher
</a>
<?php
endif
;
?>
<?php
if
(
$canApplicationModifier
)
:
?>
<br>
<?php
/** @see \Application\Controller\ApplicationController::modifierAction() */
?>
<a
href=
"
<?php
echo
$this
->
url
(
'application/modifier'
,
[
'application'
=>
$application
->
getId
()],
[],
true
);
?>
"
class=
"ajax-modal"
data-event=
"modification"
>
<span
class=
"icon icon-editer"
></span>
Modifier
</a>
<?php
endif
;
?>
<br>
<span
class=
"icon icon-lier"
></span>
Associer catégories
<?php
if
(
$canApplicationHistoriser
)
:
?>
<br>
<?php
if
(
$application
->
estNonHistorise
())
:
?>
<?php
/** @see \Application\Controller\ApplicationController::historiserAction() */
?>
<a
href=
"
<?php
echo
$this
->
url
(
'application/historiser'
,
[
'application'
=>
$application
->
getId
()],
[],
true
);
?>
"
>
<span
class=
"icon icon-historiser"
></span>
Historiser
</a>
<?php
else
:
?>
<?php
/** @see \Application\Controller\ApplicationController::restaurerAction() */
?>
<a
href=
"
<?php
echo
$this
->
url
(
'application/restaurer'
,
[
'application'
=>
$application
->
getId
()],
[],
true
);
?>
"
>
<span
class=
"icon icon-restaurer"
></span>
Restaurer
</a>
<?php
endif
;
?>
<?php
endif
;
?>
<?php
if
(
$canApplicationSupprimer
)
:
?>
<br>
<?php
/** @see \Application\Controller\ApplicationController::supprimerAction() */
?>
<a
href=
"
<?php
echo
$this
->
url
(
'application/supprimer'
,
[
'application'
=>
$application
->
getId
()],
[],
true
);
?>
"
class=
"ajax-modal"
data-event=
"modification"
>
<span
class=
"text-danger"
>
<span
class=
"icon icon-unchecked"
></span>
Supprimer
</span>
</a>
<?php
endif
;
?>
</td>
</tr>
<?php
endforeach
;
?>
</tbody>
</table>
<script>
$
(
function
()
{
$
(
"
body
"
).
on
(
"
modification
"
,
function
(
event
)
{
event
.
div
.
modal
(
'
hide
'
);
window
.
location
.
reload
();
});
});
$
(
function
()
{
$
(
"
table
"
).
DataTable
(
{
'
paging
'
:
false
,
'
info
'
:
false
,
});
});
</script>
\ No newline at end of file
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