Repository navigation
fix(occ): make tables:add work - #3186
Draft
AndyScherzinger wants to merge 3 commits into
Draft
AndyScherzinger wants to merge 3 commits into
AndyScherzinger wants to merge 3 commits into
Conversation
The command handed the user id to create() as the fourth argument, which is $description, so the table was created with the user id as its description and with no owner at all. preCheckUserId() then rejected the empty user, making every `occ tables:add` invocation fail. Assisted-by: ClaudeCode:claude-opus-5 Signed-off-by: Andy Scherzinger <[email protected]>
enhanceTable() receives the user it enriches the table for, but asked the share, row, column and view services to resolve the user from the session instead. On the command line there is no session user, so counting the columns threw an InternalError that escaped the PermissionError handler and aborted the whole create. getColumnsCount() and getRowsCount() gain an optional user id, matching the permission checks they delegate to; both already defaulted to the session user, so nothing changes for the existing callers. Assisted-by: ClaudeCode:claude-opus-5 Signed-off-by: Andy Scherzinger <[email protected]>
createColumn() returned null whenever there was no session user, so from the command line every template builder got a null column and died on the first getId() call. The rows and views were created as the session user for the same reason. The owner of the table the template is applied to is the right actor, and on the web it is the session user anyway, so the fallback only takes effect where there is no session at all. Assisted-by: ClaudeCode:claude-opus-5 Signed-off-by: Andy Scherzinger <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
occ tables:addhas never worked. It fails on every invocation, and the three reasons stack on top of each other, so each commit here only becomes visible once the previous one is in place.TableService::create(), where the signature has$description. The table was created with the user id as its description and with no owner, andpreCheckUserId()then rejected the empty user.TableService::enhanceTable()is handed the user it enriches the table for, but asked the share, row, column and view services to resolve the user from the session instead. There is no session user on the command line, sogetColumnsCount()threw anInternalError— which the surroundingcatch (PermissionError)does not catch — and aborted the create.getColumnsCount()andgetRowsCount()now take the same optional user id as the permission checks they delegate to; both still default to the session user, so nothing changes for existing callers.TableTemplateService::createColumn()returnednullwhenever there was no session user, so every template builder received a null column and died on the firstgetId()call. Template content is now created as the owner of the table it is applied to, which on the web is the session user anyway.This is pre-existing on
master, unrelated to any open pull request. It surfaced while reviewing the per-user archiving work, which is why it is split out here rather than carried along there.Opened as a draft: it is a behaviour fix on paths the web UI also uses, so it deserves a maintainer's look at the widened
getColumnsCount()/getRowsCount()signatures and at the template owner fallback before it goes in.🖼️ Screenshots
Error occurred: PreCheck for userId failed, requested in OCA\Tables\Service\PermissionsService."ownership": "admin"and an empty"description"Verified on a local Nextcloud instance:
occ tables:add admin "…"with no template, with--template customand with each oftodo,members,weight,vacation-requests,customersandtutorial. All six templates now create their columns, rows and views.🏁 Checklist
/backport to stableX.X🤖 AI (if applicable)