19 declare(strict_types=1);
59 private readonly \
ilCtrl $ctrl,
64 private readonly \
ilObjUser $current_user,
79 $this->operations[$op[
'ops_id']] = $op[
'operation'];
93 $cf = $this->ui_factory->table()->column();
95 return $this->ui_factory->table()->data(
97 $this->
lng->txt(
'rbac_log'),
99 self::COLUMN_DATE => $cf->date(
100 $this->
lng->txt(
'date'),
103 self::COLUMN_NAME => $cf->text($this->lng->txt(
'name')),
104 self::COLUMN_LOGIN => $cf->text($this->lng->txt(
'login')),
105 self::COLUMN_ACTION => $cf->text($this->lng->txt(
'action')),
106 self::COLUMN_CHANGES => $cf->text($this->lng->txt(
'rbac_changes'))
107 ->withIsSortable(
false)
109 )->withRequest($this->request);
114 $ff = $this->ui_factory->input()->field();
117 self::FILTER_FIELD_ACTION => $ff->multiSelect(
118 $this->
lng->txt(
'action'),
121 self::FILTER_FIELD_PERIOD => $ff->duration($this->lng->txt(
'date'))
124 $active = array_fill(0, count(
$inputs),
true);
126 $filter = $this->ui_service->filter()->standard(
128 $this->
ctrl->getFormActionByClass([get_class($this->gui_object), \ilPermissionGUI::class],
'log'),
140 array $visible_column_ids,
144 ?array $additional_parameters
146 $log_data = $this->rbac_log->getLogItems(
153 foreach ($log_data as $entry) {
156 (
string) $entry[
'log_id'],
159 ->setTimezone(
new \
DateTimeZone($this->current_user->getTimeZone())),
160 self::COLUMN_NAME =>
"{$user_data['lastname']}, {$user_data['firstname']}",
161 self::COLUMN_LOGIN => $user_data[
'login'],
162 self::COLUMN_ACTION => $this->action_map[$entry[
'action']] ??
'',
163 self::COLUMN_CHANGES => $this->
buildChangeColumn($entry[
'action'], $entry[
'data'] ?? [])
171 ?array $additional_parameters
173 return $this->rbac_log->getLogItemsCount($this->
getRefId(), $filter_data);
182 return $this->gui_object->getRefId();
187 $user_format = $this->current_user->getDateFormat();
189 return $this->data_factory->dateFormat()->withTime24($user_format);
191 return $this->data_factory->dateFormat()->withTime12($user_format);
196 $transformed_values = [
197 'action' => $filter_values[
'action']
199 if (isset($filter_values[
'period'][0])) {
200 $transformed_values[
'from'] = (new \DateTimeImmutable(
201 $filter_values[
'period'][0],
205 if (isset($filter_values[
'period'][1])) {
206 $transformed_values[
'to'] = (new \DateTimeImmutable(
207 $filter_values[
'period'][1] .
'23:59:59',
211 return $transformed_values;
218 return "{$this->lng->txt('rbac_log_changed_owner')}: {$user_name}";
232 if (isset($raw[
'src']) && is_int($raw[
'src'])) {
235 $result[] =
"{$this->lng->txt('rbac_log_source_object')}: " 236 .
'<a href="' . \ilLink::_getLink($raw[
'src']) .
'">' 241 foreach ($raw[
'ops'] as $role_id => $ops) {
242 foreach ($ops as $op) {
244 $this->
lng->txt(
'rbac_log_operation_add'),
246 ) .
': ' . $this->
getOPCaption($this->gui_object->getObject()->getType(), $op);
249 } elseif (isset($raw[
'ops'])) {
250 foreach ($raw[
'ops'] as $role_id => $actions) {
251 foreach ($actions as $action => $ops) {
252 foreach ((array) $ops as $op) {
254 $this->
lng->txt(
'rbac_log_operation_' . $action),
256 ) .
': ' . $this->
getOPCaption($this->gui_object->getObject()->getType(), $op);
262 if (isset($raw[
'inht'])) {
263 foreach ($raw[
'inht'] as $action => $role_ids) {
264 foreach ((array) $role_ids as $role_id) {
266 $this->
lng->txt(
'rbac_log_inheritance_' . $action),
273 return implode(
'<br>', $result);
279 foreach ($raw as $type => $actions) {
280 foreach ($actions as $action => $ops) {
281 foreach ($ops as $op) {
283 $this->
lng->txt(
'rbac_log_operation_' . $action),
284 $this->
lng->txt(
'obj_' . $type)
289 return implode(
'<br>', $result);
292 private function getOPCaption(
string $type, array|
int|
string $op): string
297 fn(
string $c, array|
int|
string $v) => $c ===
'' 304 if (!isset($this->operations[$op])) {
308 $op_id = $this->operations[$op];
309 if (substr($op_id, 0, 7) !==
'create_') {
323 if ($this->
lng->exists($type .
'_' . $op_id .
'_short')) {
324 return $this->
lng->txt($type .
'_' . $op_id .
'_short');
327 return $this->
lng->txt($op_id);
332 $obj_type = substr($op_id, 7, strlen($op_id));
339 return $this->
lng->txt(
'rbac_' . $op_id);
344 if ($this->object_definition->isPlugin($type)) {
345 return \ilObjectPlugin::lookupTxtById($type, $op_id);
352 return $perm !==
null && strpos($perm, $op_id) ===
false;
buildUserDateTimeFormat()
static _lookupFullname(int $a_user_id)
getOPCaption(string $type, array|int|string $op)
getTranslationFromPlugin(string $type, string $op_id)
getTotalRowCount(?array $filter_data, ?array $additional_parameters)
Mainly for the purpose of pagination-support, it is important to know about the total number of recor...
const FILTER_FIELD_ACTION
static _lookupName(int $a_user_id)
lookup user name
applyFilterValuesTrafos(array $filter_values)
getCreateTranslation(string $type, string $op_id)
Both the subject and the direction need to be specified when expressing an order. ...
buildDataRow(string $id, array $record)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static _lookupTitle(int $obj_id)
getRows(DataRowBuilder $row_builder, array $visible_column_ids, Range $range, Order $order, ?array $filter_data, ?array $additional_parameters)
This is called by the table to retrieve rows; map data-records to rows using the $row_builder e...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getTranslation(string $a_role_title)
Class ilObjectGUI Basic methods of all Output classes.
static _lookupObjectId(int $ref_id)
parseChangesTemplate(array $raw)
buildChangeColumn(int $action, array $data)
getOperations()
get all possible operations
const EDIT_TEMPLATE_EXISTING
const FILTER_FIELD_PERIOD
parseChangesFaPa(array $raw)
isTranslated(?string $perm, string $op_id)
class ilRbacLog Log changes in Rbac-related settings
A simple class to express a naive range of whole positive numbers.
__construct(private readonly \ilRbacLog $rbac_log, private readonly UIFactory $ui_factory, private readonly DataFactory $data_factory, private readonly \ilLanguage $lng, private readonly \ilCtrl $ctrl, private readonly \ilUIService $ui_service, private readonly \ilObjectDefinition $object_definition, private readonly RequestInterface $request, \ilRbacReview $rbac_review, private readonly \ilObjUser $current_user, private readonly \ilObjectGUI $gui_object)
getNonCreateTranslation(string $type, string $op_id)