Search in sources :

Example 1 with BaseSimpleActionInfo

use of com.netsteadfast.greenstep.base.model.BaseSimpleActionInfo in project bamboobsc by billchen198318.

the class BaseSupportAction method isActionAuthorize.

/**
	 * ControllerAuthorityCheckInterceptor 會去掉沒有權限的action, 只是配合 json 通一變數 "isAuthorize" 要用到
	 * 
	 * @return
	 */
protected String isActionAuthorize() {
    ((BaseSimpleActionInfo) this.baseActionInfoProvide).handlerActionAnnotations();
    Subject subject = SecurityUtils.getSubject();
    if (subject.hasRole(Constants.SUPER_ROLE_ALL) || subject.hasRole(Constants.SUPER_ROLE_ADMIN)) {
        return YesNo.YES;
    }
    if (this.isControllerAuthority(((BaseSimpleActionInfo) this.baseActionInfoProvide).getActionAnnotations(), ((BaseSimpleActionInfo) this.baseActionInfoProvide).getActionMethodAnnotations(), subject)) {
        return YesNo.YES;
    }
    if (subject.isPermitted(this.baseActionInfoProvide.getPageInfoActionName() + Constants._S2_ACTION_EXTENSION)) {
        return YesNo.YES;
    }
    return YesNo.NO;
}
Also used : BaseSimpleActionInfo(com.netsteadfast.greenstep.base.model.BaseSimpleActionInfo) Subject(org.apache.shiro.subject.Subject)

Example 2 with BaseSimpleActionInfo

use of com.netsteadfast.greenstep.base.model.BaseSimpleActionInfo in project bamboobsc by billchen198318.

the class BaseSupportAction method getActionMethodProgramId.

// ----------------------------------------------------------------------------
public String getActionMethodProgramId() {
    ((BaseSimpleActionInfo) this.baseActionInfoProvide).handlerActionAnnotations();
    Annotation[] annotations = ((BaseSimpleActionInfo) this.baseActionInfoProvide).getActionMethodAnnotations();
    if (annotations == null || annotations.length < 1) {
        return "";
    }
    String progId = "";
    for (Annotation annotation : annotations) {
        if (annotation instanceof ControllerMethodAuthority) {
            progId = this.defaultString(((ControllerMethodAuthority) annotation).programId());
        }
    }
    if (StringUtils.isBlank(progId)) {
        // 沒有ControllerMethodAuthority , 就找 url 的 prog_id 參數 , 主要是 COMMON FORM 會用到
        progId = this.defaultString(ActionContext.getContext().getValueStack().findString("prog_id"));
    }
    return progId;
}
Also used : ControllerMethodAuthority(com.netsteadfast.greenstep.base.model.ControllerMethodAuthority) BaseSimpleActionInfo(com.netsteadfast.greenstep.base.model.BaseSimpleActionInfo) Annotation(java.lang.annotation.Annotation)

Aggregations

BaseSimpleActionInfo (com.netsteadfast.greenstep.base.model.BaseSimpleActionInfo)2 ControllerMethodAuthority (com.netsteadfast.greenstep.base.model.ControllerMethodAuthority)1 Annotation (java.lang.annotation.Annotation)1 Subject (org.apache.shiro.subject.Subject)1