Skip to content

Commit

Permalink
Add Access Permission for ActionBar
Browse files Browse the repository at this point in the history
  • Loading branch information
ishimoto committed Aug 3, 2012
1 parent 1d322dd commit ace1ae9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<webobject name=HasChoices><webobject name=Repetition1><webobject name=SubmitButton3></webobject>&nbsp;</webobject></webobject>
<webobject name=HasChoices><webobject name=Repetition1><webobject name="IsAllowed"><webobject name=SubmitButton3 /></webobject>&nbsp;</webobject></webobject>
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ SubmitButton3: ERXSingleButton {

HasChoices: WOConditional {
condition = hasBranchChoices;
}
}

IsAllowed : WOConditional {
condition = isDelegateAllowed;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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?
Expand Down Expand Up @@ -144,4 +143,30 @@ public void validationFailedWithException(Throwable theException,Object theValue
if(log.isInfoEnabled())
log.info("" + theException + theValue + theKeyPath);
}

/**
* <span class="en">
* Before Display the Button it will check the Permission. If no Permission are set it
* will return true, and Display the Button. (Default)
*
* Sample:
* <code>public WOComponent copyOnlineToWork(WOComponent sender)</code>
*
* Access Permission Key : <code>Delegate.copyOnlineToWork</code>
* </span>
*
* <span class="ja">
* ボタンを表示する前にアクセス権限をチェックします。アクセス権限がなければ、そのままで true として実行します。
*
* 例:
* <code>public WOComponent copyOnlineToWork(WOComponent sender)</code>
*
* アクセス権限キー: <code>Delegate.copyOnlineToWork</code>
* </span>
*
* @author ishimoto
*/
public boolean isDelegateAllowed() {
return ERXAccessPermission.instance().canWithDefault("Delegate." + branchName(), true);
}
}

0 comments on commit ace1ae9

Please sign in to comment.