Cannot delete Acces Control profile

Hi there

If I try to delete an access control profile. The profile is still in the kmc without any error message in the user interface. But if i look into the kaltlog I can see the following output:

2017-03-28 17:01:35 [0.000411] [10.10.19.46] [1581915644] [26] [API] [KalturaStatement->execute] DEBUG: Sql took - 0.00027179718017578 seconds
2017-03-28 17:01:35 [0.000616] [10.10.19.46] [1581915644] [27] [API] [kCoreException->__construct] ERR: exception 'kCoreException' with message 'no default access control on partner' in /opt/kaltura/app/alpha/lib/model/accessControl.php:42
Stack trace:
#0 /opt/kaltura/app/alpha/lib/model/om/BaseaccessControl.php(1168): accessControl->preSave(Object(KalturaPDO))
--
#9 {main}
2017-03-28 17:01:35 [0.000378] [10.10.19.46] [1581915644] [28] [API] [KalturaFrontController->getExceptionObject] ERR: exception 'KalturaAPIException' with message 'no default access control for current partner' in /opt/kaltura/app/api_v3/services/AccessControlService.php:118
Stack trace:
#0 [internal function]: AccessControlService->deleteAction(14)

So it says ‘no default access control on partner’ but how can i set the default profile? And why I cannot delete a profile?

We are using version 12.10 on debian.

Kind Regards
Roger

Hi @jess

I have not deleted the access control profile called “Default”. I was trying to delete a new created profile by myself. A relogin does not change anything :expressionless:.

Even If I create one more and try to delete this have the same result.

Actually I like to us my own created profile to be used as default when I upload content.

Kind Regards.

Hi @roger78,

After looking at the log snippet you attached, I believe you are trying to delete an access control profile that is being actively used by at least one active entry and that furthermore, the default access control cannot be found. That’s the only condition under which the KalturaErrors::CANNOT_TRANSFER_ENTRIES_TO_ANOTHER_ACCESS_CONTROL_OBJECT exception will be thrown.

The default access control profile is set during partner creation and is kept in the kaltura.partner table in the custom_data column. The data is a serialised PHP object so it’s a little hard to read if you’re a human but if you run:
mysql> select custom_data from partner where id=$YOUR_PARTNER;

You should see:
“defaultAccessControlId”;i:$YOUR_ID;
My guess is that for some reason either this doesn’t exist in your partner.custom_data or it is set to an invalid profile.

At any rate, run this:
mysql> select access_control_id, id from entry where status=2 and partner_id=$YOUR_PARTNER and access_control_id=$THE_ID_FOR_THE_ACCESS_CONTROL_YOUR_ARE_TRYING_TO_DELETE;

If it returns results, you must first change the access control for these entries to something else and only then delete the old access control profile. If there are a lot of these, you can do it using the API from a script rather than manually. You can do so by calling baseEntry->update() passing along the entry ID and the new accessControlId you wish to set.

mysql> select access_control_id, id from entry where status=2 and partner_id=$YOUR_PARTNER and access_control_id=$THE_ID_FOR_THE_ACCESS_CONTROL_YOUR_ARE_TRYING_TO_DELETE;

no results for this query.

mysql> select custom_data from partner where id=$YOUR_PARTNER;
“defaultAccessControlId”;i:$YOUR_ID;
My guess is that for some reason either this doesn’t exist in your partner.custom_data or it is set to an invalid profile.

All of my partner have not set this value “defaultAccessControlId”. It even does not appear in the custom_data. Could I set it manually to my desired “defaultAccessControl”?

Kind Regards
Roger

There no way to do it from the UI, I’m afraid.
The easiest thing to do would something like the below but BEFORE YOU DO SO, MAKE SURE TO BACKUP THE PARTNER TABLE IN CASE YOU BREAK ANYTHING.

mysql> select custom_data from partner where id=$YOUR_PARANER_ID;

Save the serialised result somewhere for quick restore.
Then, create this simple PHP script somewhere on your FS and set values for $ser_custom_data and $arr[‘defaultAccessControlId’]

<?php
$ser_custom_data=""; // set to what you got from the query
$arr=unserialize($ser_custom_data);
$arr['defaultAccessControlId']=// set to your desired AC profile;
echo (serialize($arr));

run the script and copy the output and then update:
mysql> update partner set custom_data=$NEW_CUSTOM_DATA where id=$YOUR_PARANER_ID;

Again, please be very careful and back up the partner table before doing so. If something breaks and there are no backups, it will be impossible to properly restore.