@Override public boolean isUserAuthorized(String userName, String resourceId, String action) throws UserStoreException { try { return stub.isUserAuthorized(userName, resourceId, action); } catch (Exception e) { this.handleException(e.getMessage(), e); } return false; }
public boolean isUserAuthorized(String userName, String resourceId, String action) throws UserStoreException { try { return stub.isUserAuthorized(userName, resourceId, action); } catch (Exception e) { this.handleException(e.getMessage(), e); } return false; }
/** * Query the remote user manager to find out whether the specified user has the * specified permission. * * @param user Username * @param permission A valid Carbon permission * @return true if the user has the specified permission and false otherwise * @throws org.wso2.carbon.appmgt.api.AppManagementException If and error occurs while accessing the admin service */ public boolean isUserAuthorized(String user, String permission) throws AppManagementException { CarbonUtils.setBasicAccessSecurityHeaders(username, password, true, authorizationManager._getServiceClient()); if (cookie != null) { authorizationManager._getServiceClient().getOptions().setProperty(HTTPConstants.COOKIE_STRING, cookie); } try { boolean authorized = authorizationManager.isUserAuthorized(user, permission, CarbonConstants.UI_PERMISSION_ACTION); ServiceContext serviceContext = authorizationManager. _getServiceClient().getLastOperationContext().getServiceContext(); cookie = (String) serviceContext.getProperty(HTTPConstants.COOKIE_STRING); return authorized; } catch (Exception e) { throw new AppManagementException("Error while accessing backend services for " + "user permission validation", e); } }