Published Solutions
-
Enabling or disabling toolbar buttons based on whether rows are selected in a grid
Original Publishing Date: 2020-01-22 Question: I use an 'aps/Grid' widget together with a toolbar. I would like buttons in this toolbar to only be enabled if some rows are selected in my grid. If no rows are selected, buttons should be disabled. How can I do this? Answer: You can use the 'requireSingleItem' or 'requireItems' properties. Enabling these at grid declaration makes the toolbar buttons inactive unless one (in case of 'requireSingleItems') or more items are selected in the grid. Details are available in aps/Grid specification. You can also make the buttons disabled by default and then monitor the selectionArray property of the grid which stores the selected rows. If this array is empty (i.e. nothing is selected) the buttons should be disabled. If the array is not empty, they should be enabled. For example, if grid is saved in 'grid' variable, the code can look like this: grid.selectionArray.watchElements(function(){ this.length ? [enable buttons] : [disable buttons]; }); Replace [enable buttons] and [disable buttons] with proper code that would enable or disable your buttons. This second method will work if you declare your toolbar buttons programmatically and outside of the grid object after the grid is created. Internal content
-
APS plugin not working after Eclipse upgrade
Original Publishing Date: 2020-01-22 Symptoms Eclipse was upgraded to version 4.3 and APS plugin unable to build applications anymore. No error message displayed. Cause Using the same workspace with new plugin as with the old one. Resolution Delete and re-import all projects after Eclipse is upgraded. Internal content
-
Event subscription fails
Original Publishing Date: 2020-01-22 Symptoms When i try to subscribe to the event of type 'http://parallels.com/aps/events/pa/subscription/limits/changed' I get the following error message Oct 19 12:19:39 195.214.234.4 logger: : endpoint.b.mycompany.apsdemo.org.ERROR: [enterprise] provisionEnterpriseAndSite failed ["[object] (Exception: Request to APS controller failed: \"{\n\t\"error\": \"APS::Util::Exception\",\n\t\"message\": \"Notification event 'http://parallels.com/aps/events/pa/subscription/limits/changed' is not found.\"\n}\n\n\". at /usr/share/aps/php/aps/2/apsc.php:235)"] [] Cause Subscription for the changed limits was implemented in POA poa-5.5-5562_update07 Resolution Redeploy or request another one sandbox with the latest update. Internal content
-
Localized entry points produce an error in Plesk
Original Publishing Date: 2020-01-22 Symptoms I got this error while clicking on entry point of WordPress. "Fehler: Entry point with id 'Interface administrativa' for instance with id '95881047-68cf-4af0-93fb-70ff1e309e5a' not found " APP-META is available APP-META.xml: Steps to reproduce: Download WordPress-4.0-47.app.zip Login on the Plesk 12 server as admin within Portugal language. Add the downloaded application to application vault and install in on the newly created domain Go to mydomain.com -> Applications ->select Wordpress application and click on any 'Wordpress' link in the "Administrative access entry points" section Cause Bug in Parallels Plesk. Resolution There is no workaround or custom fix. Do not use translated links in entry points for a while. Internal content Link on internal Article
-
APS security contexts
Original Publishing Date: 2020-01-22 Problem What objects can I access/modify/delete from my application? Resolution There are two major security contexts: APS custom UI runs in account context, it can see all resources belonging to account and the ones provided by 'Application Service Reference' resource type APS endpoint runs in application context, it can see all resources belonging to application itself (all instances of its resources) Account security level When requests are sent under account identity there are some restrictions: encrypted properties are not returned by controller only viewing (GET) is allowed for APS resources provided by 'Application Service Reference', to create/modify/delete the resource corresponding access role needs to be added into schema of resource initiating operation. All account resources are available under this identity: account information, subscriptions, service users, domains, mailboxes etc including all APS resources owned by account. Possible usage scenarios: listing service users available for account for user to choose to link to one of the services read account personal information to pass it to application backend (name, phone number, email address etc) Application security level When requests are sent under application identity there are some other restrictions: only instances of application resources are returned (belonging to both provider and all accounts) other resources need to be linked to one of the application resources for application to read its properties For example: application can get service user properties provided it is linked to a resource of application Usually all CRUD operations are initiated by user from UI through APS controller (for that resource should have methods provision(), configure(), unprovision()), during provisioning all relational properties are filled with links to corresponding objects, for example there is a relation to subscription: "subscription": { "type": "http://aps-standard.org/types/core/subscription/1.0", "required": true, "collection": false }, You can get subscription id that provides this resource from this relation (core/subscription schema) subscription_id = $this->subscription->subscriptionId But sometimes the application itself needs to contact the controller, possible usage scenarios: To perform asynchronous operations: Example: you can call some long-running operation from UI, for example to sync user data, a call is placed to application backend, when endpoint receives the result it initiates a connection to APS controller to update the resources To push changes to APS controller: Example: you collected resource usage and need to update resources with it. To get encrypted properties from the controller such as passwords: Example: you need to get service user password. Notes: application can impersonate an account to get rid of its restrictions, for that it needs to pass APS-Resource-ID header with an id of any resource that belongs to needed account (subscription in the example below). This can be done using APS-PHP-runtime: $apsc = \APS\Request::getController(); $apsc_acc = $apsc->impersonate($this->subscription->aps->id); $apsc_acc->getResource($res_id); $all_resources = $apsc_acc->getIo()->sendRequest(\APS\Proto::GET, "/aps/2/resources/"); where $res_id is an ID of a resource that is not available from application context. You can use $apsc to connect authenticating with application certificate and $apsc_app when you need to impersonate an account. Please remember the following rules about impersonation: Application can impersonate only using application own resource. You can impersonate only using a resource which status is aps:ready. It means that there is no way to impersonate in provision or unprovision method of top (context) resource in a subscription. When installing other resources in subscription, use context resource for impersonation. If you use object as a parameter to this function, make sure this object has aps->id property. Internal content
-
WordPress upgrade differences between APS application upgrade and 'Wordpress Tollkit' upgrade
Original Publishing Date: 2020-01-22 Symptoms What are the differences in upgrade process for Wordpress between when Wordpress Toolkit is enabled and when it is disabled? Resolution WordPress Toolkit detects installed Wordpress instances. It does not matter if the instance was installed from APS catalog or manually. When you press Update, WP Toolkit initiates searching for available updates for each instance directly using native methods. Each instance will then look for available updates from wordpress.org using curl requests. APS application upgrade will not be performed in this case. This means that APS controller's notion of installed version will differ from the actual version therefore giving inconsistent system. If WordPress toolkit is disabled then all APS WordPress instances will be upgraded during daily maintenance script execution in case a newer version of application is available in application vault (or in APS catalog) and auto-updates for this application are enabled. Internal content
-
How to customize password complexity calculation for aps/Password widget
Original Publishing Date: 2020-01-22 Symptoms I am trying to use the aps/Password widget in my application. By default, it only takes into account password length when setting password complexity. How do I replace that with my own password complexity calculation logic? Resolution You should create your own 'calcStrength' method. For example, this is how I can make my widget set maximum password complexity when user enters 'password' for password and minimum in all other cases: require(["dojo/parser", "aps/Password", "aps/ready!"], function(parser, Password){ pwd = new Password(); pwd.calcStrength = function(value){return (value == "password") ? this.classesMap.length : 0; }; pwd.placeAt("body", "last"); parser.parse(); }); Refer to the aps/Password widget documentation page page for more information. Internal content
-
APS 1.2 Introductory information
Original Publishing Date: 2020-01-22 Problem Where I can get introductory information to start packaging applications in APS1? Resolution APS documentation can be found here. Application Packaging Guide :you can find there some basic scenarios and sample Metadata files, that can help at the beginning. For example, Wordpress Sample Metadata file. APS format specification. Internal content
-
Not possible to change resource status
Original Publishing Date: 2020-01-22 Symptoms I want to change status of resource but an error is returned: "message": "Specified resource status `aps:REQUESTED_STATUS` is not ready or proto." Cause aps namespace is reserved for system usage, application itself can use custom statuses or return resource back to aps:ready. Usage of other system statuses as target is prohibited. Details are available on the Resource Statuses page in documentation. Resolution Use custom statuses (not in aps namespace) or add a custom field to your resource to keep track of additional statuses. Internal content
-
'Navigation element not found' error when two instances of the same service are created
Original Publishing Date: 2020-01-22 Symptoms I have an application that works fine until I create two instances of the same resource, after that navigation via aps.apsc.gotoView stops working, an error "Navigation element not found (View: http://example.org//application/account.edit-notify#41;" is displayed. Cause Resource instance identifying information is not sent to view, as a result POA cannot render it. Resolution Pass resource id to aps.apsc.gotoView via a variable: aps.apsc.gotoView("account.edit-notify", aps.context.vars.account.aps.id); Note: variable 'account' has to be defined in navigation in APP-META.xml. More on navigation in documentation. Internal content