/** * Show the permissions for a user * * @param array $options Command line options * @param OutputInterface $output Output interface object */ public function showUserPermissions(array $options = array(), $output) { if (empty($options['id'])) { throw new \InvalidArgumentException('You must specify a user ID!'); } $user = Gatekeeper::findUserById($options['id']); $output->writeln("\n" . 'Showing permissions for <options=bold>' . $user->username . '</options=bold>'); $params = array('userId' => $options['id']); $columns = array('name' => 'Name', 'description' => 'Description', 'created' => 'Date Created', 'updated' => 'Date Updated', 'id' => 'ID'); $data = array(); $ds = Gatekeeper::getDatasource(); $permissions = Gatekeeper::findUserPermissions($params); foreach ($permissions->toArray(true) as $permission) { $perm = new \Psecio\Gatekeeper\PermissionModel($ds); $perm = $ds->find($perm, array('id' => $permission['permissionId'])); $data[] = $perm->toArray(); } $this->buildTable($columns, $data, $output); }