• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

RPC API: Which users are associated with this domain?

L

LukeSTN

Guest
PRODUCT, VERSION, MICROUPDATE, OPERATING SYSTEM, ARCHITECTURE
(Plesk) 10.4.4 Update #39, last updated at July 16, 2012 04:34 AM
Red Hat Enterprise Linux Server release 6.1 (Santiago)
Linux 2.6.32-131.28.1.el6.x86_64

PROBLEM DESCRIPTION
I can't see a way to find out which Plesk Panel login name(s) is/are associated
with a given domain (webspace/subscription) via the XML RPC API.

STEPS TO REPRODUCE
#1) Issue this RPC request:
<packet version="1.6.3.4">
<webspace>
<get>
<filter>
<name>test.domain.com</name>
</filter>
<dataset>
<gen_info />
<subscriptions/>
<hosting />
<limits />
<stat />
<prefs />
<plan-items />
</dataset>
</get>
</webspace>
</packet>
#2) Inspect result for anything that can be used in another RPC request to
locate the Plesk Panel accounts associated with this webspace.

ACTUAL RESULT
Returns user 'id'.

EXPECTED RESULT
Returns user 'guid'.
 
Assuming I have the domain name, and the webspace guid, is there any way I can obtain the login name for the plesk panel "owner" of that webspace?
 
More detailed description of my goals/methods

Code:
What I'm trying to do:
	When a Domain is assigned a Customer in Plesk:
		* If domain is in service plan "Restrict"
			* Modify "Owner" role for domain/service plan to:
				* -userManagement false \
				* -webSitesAndDomainsManagement false \
				* -logRotationManagement false \
				* -anonymousFtpManagement false \
				* -scheduledTasksManagement false \
				* -spamfilterManagement true \
				* -antivirusManagement false \
				* -databasesManagement false \
				* -backupRestoreManagement false \
				* -browseStats true \
				* -applicationsManagement false \
				* -sitebuilderManagement false \
				* -filesManagement false \
				* -ftpAccountsManagement false \
				* -dnsManagement false \
				* -javaApplicationsManagement false \
				* -mailManagement true \
				* -mailListsManagement true
				(using the command line psa/bin/role command)
Technical walkthrough:
	So, what I need to do is isolate the events related to changing the 
	subscription owner.
	To the best of my knowledge the best candidates for this are event:
		#32) Default domain (the first domain added to a subscription/webspace) updated
		#34) Subscription owner changed
	I determined this by creating a script that logged the available environment
	and attached it to every available event handler, noticing that only event
	numbers 32 and 34 seemed named correctly for the type of thing I was doing,
	provided (what I thought was) enough information to achieve my goal, and 
	where actually fired when I took the expected actions in the Plesk Panel
	------
	From here I started researching the XML RPC API to determine if I could use
	the information provided event '32' to isolate:
		* The Service Plan Name of the domain
		* The assigned customer of the domain
		* The role 'Owner' for that domain
	With the intent of modifying the 'Owner' role for that user, e.g.:
		/usr/local/psa/bin/role -u Owner -owner 'LoginName' \
			-userManagement false \
			-webSitesAndDomainsManagement false \
			-logRotationManagement false \
			-anonymousFtpManagement false \
			-scheduledTasksManagement false \
			-spamfilterManagement true \
			-antivirusManagement false \
			-databasesManagement false \
			-backupRestoreManagement false \
			-browseStats true \
			-applicationsManagement false \
			-sitebuilderManagement false \
			-filesManagement false \
			-ftpAccountsManagement false \
			-dnsManagement false \
			-javaApplicationsManagement false \
			-mailManagement true \
			-mailListsManagement true
	I ran into a disconnect in the API when I attempted to connect the dots 
	between the subscription call:
		<packet version="1.6.3.4">
			<webspace>
				<get>
					<filter>
						<name>testurl.com</name>
					</filter>
					<dataset>
						<gen_info />
						<subscriptions/>
						<hosting />
						<limits />
						<stat />
						<prefs />
						<plan-items />
					</dataset>
				</get>
			</webspace>
		</packet>
	And the user login name of the assigned customer. Meaning I could not find 
	a way to determine the login name via the API for the 'Owner' of a subscription
	------
	Having said that, I think I can do all of this without issue, for event #34.
 
As a follow up I was able to achieve limited success with event '34', but as this is not fired in all circumstances I would like to also get it working in event '32'
 
Back
Top