private static function addAccessControlRule($policyId) { $rule = new kRule(); $action = new kAccessControlDrmPolicyAction(); $action->setPolicyId($policyId); $rule->setActions(array($action)); return $rule; }
private static function addAccessControlRule($priviledge, $policyId) { $rule = new kRule(); $condition = new kAuthenticatedCondition(); $condition->setPrivileges(array($priviledge)); $action = new kAccessControlDrmPolicyAction(); $action->setPolicyId($policyId); $rule->setConditions(array($condition)); $rule->setActions(array($action)); return $rule; }
$partners = array(); foreach ($permissions as $perm) { $partners[] = $perm->getPartnerId(); } KalturaLog::debug("Partners are '" . print_r($partners, true) . "'"); $c = new Criteria(); $c->add(accessControlPeer::PARTNER_ID, $partners, Criteria::IN); $c->addAnd(accessControlPeer::RULES, '%kAccessControlPlayReadyPolicyAction%', Criteria::LIKE); $acs = accessControlPeer::doSelect($c); foreach ($acs as $ac) { KalturaLog::debug("checking access control '" . $ac->getId() . "'"); $rules = $ac->getRulesArray(); foreach ($rules as $rule) { $actions = $rule->getActions(); $j = 0; foreach ($actions as $action) { KalturaLog::debug("checking action '" . print_r($action, true) . "'"); if (get_class($action) == 'kAccessControlPlayReadyPolicyAction') { KalturaLog::debug("replacing kAccessControlPlayReadyPolicyAction with kAccessControlDrmPolicyAction"); $newAction = new kAccessControlDrmPolicyAction(); $newAction->setPolicyId($action->getPolicyId()); $actions[$j] = $newAction; $rule->setActions($actions); $ac->setRulesArray($rules); $ac->save(); KalturaLog::debug("finished saving"); } $j++; } } }