Also take into account sublink's permission
This commit is contained in:
@@ -386,11 +386,11 @@ feature -- Generation
|
|||||||
across
|
across
|
||||||
a_menu_system as c
|
a_menu_system as c
|
||||||
loop
|
loop
|
||||||
prepare_menu (c.item)
|
prepare_links (c.item)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
prepare_menu (a_menu: CMS_MENU)
|
prepare_links (a_menu: CMS_LINK_COMPOSITE)
|
||||||
local
|
local
|
||||||
to_remove: ARRAYED_LIST [CMS_LINK]
|
to_remove: ARRAYED_LIST [CMS_LINK]
|
||||||
do
|
do
|
||||||
@@ -399,11 +399,17 @@ feature -- Generation
|
|||||||
a_menu as c
|
a_menu as c
|
||||||
loop
|
loop
|
||||||
if attached {CMS_LOCAL_LINK} c.item as lm then
|
if attached {CMS_LOCAL_LINK} c.item as lm then
|
||||||
if not has_permissions (lm.permission_arguments) then
|
if attached lm.permission_arguments as perms and then not has_permissions (perms) then
|
||||||
to_remove.force (lm)
|
to_remove.force (lm)
|
||||||
else
|
else
|
||||||
|
-- if lm.permission_arguments is Void , this is permitted
|
||||||
lm.get_is_active (request)
|
lm.get_is_active (request)
|
||||||
|
if attached {CMS_LINK_COMPOSITE} lm as comp then
|
||||||
|
prepare_links (comp)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
elseif attached {CMS_LINK_COMPOSITE} c.item as comp then
|
||||||
|
prepare_links (comp)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
across
|
across
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ deferred class
|
|||||||
inherit
|
inherit
|
||||||
REFACTORING_HELPER
|
REFACTORING_HELPER
|
||||||
|
|
||||||
|
DEBUG_OUTPUT
|
||||||
|
|
||||||
|
ITERABLE [CMS_LINK]
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
title: READABLE_STRING_32
|
title: READABLE_STRING_32
|
||||||
@@ -44,4 +48,24 @@ feature -- Query
|
|||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
new_cursor: ITERATION_CURSOR [CMS_LINK]
|
||||||
|
-- Fresh cursor associated with current structure
|
||||||
|
do
|
||||||
|
if attached children as lst then
|
||||||
|
Result := lst.new_cursor
|
||||||
|
else
|
||||||
|
Result := (create {ARRAYED_LIST [CMS_LINK]}.make (0)).new_cursor
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Status report
|
||||||
|
|
||||||
|
debug_output: STRING
|
||||||
|
-- String that should be displayed in debugger to represent `Current'.
|
||||||
|
do
|
||||||
|
Result := title.as_string_8 + " -> " + location
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,6 +10,13 @@ class
|
|||||||
inherit
|
inherit
|
||||||
CMS_LINK
|
CMS_LINK
|
||||||
|
|
||||||
|
CMS_LINK_COMPOSITE
|
||||||
|
rename
|
||||||
|
items as children,
|
||||||
|
extend as add_link,
|
||||||
|
remove as remove_link
|
||||||
|
end
|
||||||
|
|
||||||
create
|
create
|
||||||
make
|
make
|
||||||
|
|
||||||
@@ -30,8 +37,14 @@ feature -- Status report
|
|||||||
is_active: BOOLEAN
|
is_active: BOOLEAN
|
||||||
|
|
||||||
is_expanded: BOOLEAN
|
is_expanded: BOOLEAN
|
||||||
|
do
|
||||||
|
Result := is_expandable and then internal_is_expanded
|
||||||
|
end
|
||||||
|
|
||||||
is_expandable: BOOLEAN
|
is_expandable: BOOLEAN
|
||||||
|
do
|
||||||
|
Result := internal_is_expandable or internal_is_expanded or has_children
|
||||||
|
end
|
||||||
|
|
||||||
has_children: BOOLEAN
|
has_children: BOOLEAN
|
||||||
do
|
do
|
||||||
@@ -42,6 +55,10 @@ feature -- Status report
|
|||||||
|
|
||||||
children: detachable LIST [CMS_LINK]
|
children: detachable LIST [CMS_LINK]
|
||||||
|
|
||||||
|
internal_is_expandable: BOOLEAN
|
||||||
|
|
||||||
|
internal_is_expanded: BOOLEAN
|
||||||
|
|
||||||
feature -- Element change
|
feature -- Element change
|
||||||
|
|
||||||
add_link (lnk: CMS_LINK)
|
add_link (lnk: CMS_LINK)
|
||||||
@@ -56,6 +73,19 @@ feature -- Element change
|
|||||||
lst.force (lnk)
|
lst.force (lnk)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
remove_link (lnk: CMS_LINK)
|
||||||
|
local
|
||||||
|
lst: like children
|
||||||
|
do
|
||||||
|
lst := children
|
||||||
|
if lst /= Void then
|
||||||
|
lst.prune_all (lnk)
|
||||||
|
if lst.is_empty then
|
||||||
|
children := Void
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
set_children (lst: like children)
|
set_children (lst: like children)
|
||||||
do
|
do
|
||||||
children := lst
|
children := lst
|
||||||
@@ -63,18 +93,12 @@ feature -- Element change
|
|||||||
|
|
||||||
set_expanded (b: like is_expanded)
|
set_expanded (b: like is_expanded)
|
||||||
do
|
do
|
||||||
is_expanded := b
|
internal_is_expanded := b
|
||||||
if b then
|
|
||||||
is_expandable := True
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
set_expandable (b: like is_expandable)
|
set_expandable (b: like is_expandable)
|
||||||
do
|
do
|
||||||
is_expandable := b
|
internal_is_expandable := b
|
||||||
if not b then
|
|
||||||
is_expanded := False
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
get_is_active (req: WSF_REQUEST)
|
get_is_active (req: WSF_REQUEST)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class
|
|||||||
CMS_MENU
|
CMS_MENU
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
ITERABLE [CMS_LINK]
|
CMS_LINK_COMPOSITE
|
||||||
|
|
||||||
create
|
create
|
||||||
make,
|
make,
|
||||||
|
|||||||
Reference in New Issue
Block a user