From ace1ae91c78182bade7aa3d96d62eb2dec94b434 Mon Sep 17 00:00:00 2001 From: Ken ISHIMOTO Date: Fri, 3 Aug 2012 18:40:17 +0200 Subject: [PATCH] Add Access Permission for ActionBar --- .../ERDActionBar.wo/ERDActionBar.html | 2 +- .../ERDActionBar.wo/ERDActionBar.wod | 6 +++- .../directtoweb/components/ERDActionBar.java | 29 +++++++++++++++++-- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/Frameworks/Core/ERDirectToWeb/Components/Nonlocalized.lproj/ERDActionBar.wo/ERDActionBar.html b/Frameworks/Core/ERDirectToWeb/Components/Nonlocalized.lproj/ERDActionBar.wo/ERDActionBar.html index 679b543de9b..f6582b9baee 100644 --- a/Frameworks/Core/ERDirectToWeb/Components/Nonlocalized.lproj/ERDActionBar.wo/ERDActionBar.html +++ b/Frameworks/Core/ERDirectToWeb/Components/Nonlocalized.lproj/ERDActionBar.wo/ERDActionBar.html @@ -1 +1 @@ -  \ No newline at end of file +  \ No newline at end of file diff --git a/Frameworks/Core/ERDirectToWeb/Components/Nonlocalized.lproj/ERDActionBar.wo/ERDActionBar.wod b/Frameworks/Core/ERDirectToWeb/Components/Nonlocalized.lproj/ERDActionBar.wo/ERDActionBar.wod index 792ef9c6483..933c785b4eb 100644 --- a/Frameworks/Core/ERDirectToWeb/Components/Nonlocalized.lproj/ERDActionBar.wo/ERDActionBar.wod +++ b/Frameworks/Core/ERDirectToWeb/Components/Nonlocalized.lproj/ERDActionBar.wo/ERDActionBar.wod @@ -12,4 +12,8 @@ SubmitButton3: ERXSingleButton { HasChoices: WOConditional { condition = hasBranchChoices; -} \ No newline at end of file +} + +IsAllowed : WOConditional { + condition = isDelegateAllowed; +} diff --git a/Frameworks/Core/ERDirectToWeb/Sources/er/directtoweb/components/ERDActionBar.java b/Frameworks/Core/ERDirectToWeb/Sources/er/directtoweb/components/ERDActionBar.java index 25eac723290..720c87fe834 100644 --- a/Frameworks/Core/ERDirectToWeb/Sources/er/directtoweb/components/ERDActionBar.java +++ b/Frameworks/Core/ERDirectToWeb/Sources/er/directtoweb/components/ERDActionBar.java @@ -11,6 +11,7 @@ import er.directtoweb.delegates.ERDBranchDelegate; import er.directtoweb.delegates.ERDBranchDelegateInterface; import er.directtoweb.delegates.ERDBranchInterface; +import er.extensions.security.ERXAccessPermission; /** * Displays a set of buttons and calls the enclosing page's branch delegate with it. @@ -19,9 +20,7 @@ * @binding d2wContext the context for this component * * @author ak on Sun Jan 26 2003 - * @project ERExtras */ - public class ERDActionBar extends ERDCustomEditComponent implements ERDBranchInterface { /** * Do I need to update serialVersionUID? @@ -144,4 +143,30 @@ public void validationFailedWithException(Throwable theException,Object theValue if(log.isInfoEnabled()) log.info("" + theException + theValue + theKeyPath); } + + /** + * + * Before Display the Button it will check the Permission. If no Permission are set it + * will return true, and Display the Button. (Default) + * + * Sample: + * public WOComponent copyOnlineToWork(WOComponent sender) + * + * Access Permission Key : Delegate.copyOnlineToWork + * + * + * + * ボタンを表示する前にアクセス権限をチェックします。アクセス権限がなければ、そのままで true として実行します。 + * + * 例: + * public WOComponent copyOnlineToWork(WOComponent sender) + * + * アクセス権限キー: Delegate.copyOnlineToWork + * + * + * @author ishimoto + */ + public boolean isDelegateAllowed() { + return ERXAccessPermission.instance().canWithDefault("Delegate." + branchName(), true); + } }