Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
intranet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Bertrand Delhomme
intranet
Commits
362ad450
Commit
362ad450
authored
Apr 15, 2010
by
Nicolas Dandrimont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[settings,accueil] Filtrage de la page d'accueil selon les droits
parent
6c618457
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
6 deletions
+23
-6
accueil.py
accueil.py
+8
-3
settings.py
settings.py
+15
-3
No files found.
accueil.py
View file @
362ad450
...
...
@@ -31,7 +31,12 @@ from django.contrib.auth.decorators import login_required
def
view
(
request
):
'''Affiche toutes les applications disponibles en fonction des
droits de la personne connectée.'''
session
=
request
.
session
apps
=
list
(
settings
.
INTRANET_APPS
)
apps
.
sort
(
lambda
x
,
y
:
cmp
(
x
[
'category'
],
y
[
'category'
]))
apps
=
[]
for
app
in
settings
.
INTRANET_APPS
:
if
'test'
in
app
:
if
app
[
'test'
](
request
.
user
):
apps
.
append
(
app
)
else
:
apps
.
append
(
app
)
apps
.
sort
(
key
=
lambda
x
:
(
x
[
'category'
],
x
[
'name'
]))
return
django
.
shortcuts
.
render_to_response
(
"accueil.html"
,
locals
(),
context_instance
=
RequestContext
(
request
))
settings.py
View file @
362ad450
...
...
@@ -113,9 +113,21 @@ AUTHENTICATION_BACKENDS = (
INTRANET_APPS
=
(
{
'name'
:
'dummy'
,
'category'
:
'Beta'
},
{
'name'
:
'prises'
,
'category'
:
'Administration'
},
{
'name'
:
'impression'
,
'category'
:
'Services'
},
{
'name'
:
'dummy'
,
'category'
:
'Beta'
,
'test'
:
lambda
u
:
u
.
groups
.
filter
(
name
=
'crans_nounou'
),
},
{
'name'
:
'prises'
,
'category'
:
'Administration'
,
'test'
:
(
lambda
u
:
u
.
has_perm
(
'prises.can_view'
)),
},
{
'name'
:
'impression'
,
'category'
:
'Services'
,
'test'
:
(
lambda
u
:
u
.
groups
.
filter
(
name
=
'crans_nounou'
)
or
u
.
groups
.
filter
(
name
=
'crans_apprenti'
)),
},
)
INSTALLED_APPS
=
(
...
...
Write
Preview
Markdown
is supported
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