public void doAccessControlEnabled(boolean enabled) throws Exception { Log.d(TAG, "DoAccessControlEnabled: " + enabled); // Create post data Map<String, String> postData = createAccessControlEnabledPostData(enabled); Log.d(TAG, "Post Data:\n" + Utils.mapToString(postData)); // Post access control data RestClient restClient = createRestClient(getRouterPage(this.getRouterParsing().advanced_accesscontrol.page)); restClient.addData(postData); Response response = restClient.execute(RequestMethod.POST); // Is logged in if (isNotLoggedIn(response)) throw new NotLoggedinException(); }
public void doAccessControlPolicy(boolean enabled, int policyId) throws Exception { Log.d(TAG, "doAccessControlPolicyEnabled: " + enabled + ", " + policyId); // Create post data Integer[] policyIds = {policyId}; Map<String, String> postData = createAccessControlEnablePolicyPostData( enabled ? policyIds : null, !enabled ? policyIds : null); Log.d(TAG, "Post Data:\n" + Utils.mapToString(postData)); // Post access control data RestClient restClient = createRestClient(getRouterPage(this.getRouterParsing().advanced_accesscontrol.page)); restClient.addData(postData); Response response = restClient.execute(RequestMethod.POST); // Is logged in if (isNotLoggedIn(response)) throw new NotLoggedinException(); }
public ControlHandlerAsyncTaskResult<AccessControlContainer> doAccessControlRetrieve() throws Exception { Log.d(TAG, "DoAccessControlRetrieve"); // Get access control page RestClient restClient = createRestClient(getRouterPage(this.getRouterParsing().advanced_accesscontrol.page)); Response response = restClient.execute(RequestMethod.GET); // Is logged in if (isNotLoggedIn(response)) throw new NotLoggedinException(); // Is correct page if (!isPageAccessControl(response.getResponse())) throw new InvalidPageException(); // Access control AccessControlContainer accessControlContainer = new AccessControlContainer(); accessControlContainer.enabled = isAccessControlEnabled(response.getResponse()); accessControlContainer.getPolicies().addAll(createPolicies(response.getResponse())); return new ControlHandlerAsyncTaskResult<AccessControlContainer>(accessControlContainer); }