Query - Extra Tech to User - Rule
SELECT DISTINCT endpointname AS 'Application',
username,name AS 'Account Name',
CASE
WHEN customerent IS NOT NULL THEN rule
WHEN entswithnewaccount = entitlement_value THEN 'Birth Right'
end AS 'Application Rule',
entitlement_value AS 'Entitlement Role',
entitlementendpointname AS 'Entitlement Endpoint',
CASE
WHEN customerent IS NOT NULL THEN 'Yes'
WHEN entswithnewaccount = entitlement_value THEN 'Yes'
ELSE 'No'
end AS
'Entitlement Role according to Application Rule'
FROM (SELECT *,
(SELECT cv.entitlement_values
FROM customer_entitlementvalues cv,
customer c
WHERE c.customerkey = cv.customerkey
AND c.customername = account_access.rule
AND cv.entitlement_values =
account_access.entitlement_valuekey
LIMIT 1) AS customerent
FROM (SELECT a.accountkey,
ev.entitlement_valuekey,
a.name,
e.endpointname,
ete.endpointname
AS
entitlementendpointname,
ev.entitlement_value,
e.endpointkey,
a.customproperty30
AS
username,
(SELECT ev1.entitlement_value
FROM endpoints e1,
entitlement_values ev1
WHERE e1.endpointkey IN ( e.endpointkey )
AND ev1.entitlement_valuekey IN
( e1.entswithnewaccount )) AS
entswithnewaccount,
CASE
WHEN e.endpointname = 'eMarketPlace' THEN
Concat(e.endpointname, '_Role_', a.customproperty12)
WHEN e.endpointname = 'MDN' THEN
Concat(e.endpointname, '_', a.customproperty21, '_',
a.customproperty13)
WHEN e.endpointname = 'Synapse' THEN
Concat(e.endpointname, '_', a.customproperty12)
WHEN e.endpointname = 'MCC' THEN
Concat(e.endpointname, '_', a.customproperty13)
WHEN e.endpointname LIKE 'EC_%' THEN
Concat(e.endpointname, '_', a.customproperty13)
end
AS
RULE
FROM accounts a,
endpoints e,
account_entitlements1 ae,
entitlement_values ev,
entitlement_types et,
endpoints ete
WHERE e.endpointkey = a.endpointkey
AND a.status IN ( 1, 'Active', 'Manually Provisioned' )
AND ae.accountkey = a.accountkey
AND ev.entitlement_valuekey = ae.entitlement_valuekey
AND ev.entitlementtypekey = et.entitlementtypekey
AND et.endpointkey = ete.endpointkey
AND e.endpointname IN ( 'AAA' ))
account_access)
extraaccess
Comments
Post a Comment