Skip to content

[17.0][ADD] project_create_restriction#30

Open
cgarcia-solvos wants to merge 1 commit into17.0from
17.0-add-project_create_restriction
Open

[17.0][ADD] project_create_restriction#30
cgarcia-solvos wants to merge 1 commit into17.0from
17.0-add-project_create_restriction

Conversation

@cgarcia-solvos
Copy link
Copy Markdown

Restrict project and task creation based on user groups

@cgarcia-solvos cgarcia-solvos force-pushed the 17.0-add-project_create_restriction branch 2 times, most recently from a17bc6a to 4900700 Compare January 19, 2026 15:10
Copy link
Copy Markdown
Contributor

@dalonsod dalonsod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments, only code review


if (
operation != "read"
and self.env.uid != 1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


if (
operation in ("create", "unlink")
and self.env.uid != 1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same as above

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because "not self.env.su" checks whether the operation is being executed in a sudo environment, whereas "self.env.uid != 1" checks whether the real user is the system administrator.
In the case of product, using "self.env.su" was sufficient, as record creation is usually not performed with "sudo()". However, in project, project and task creation rely heavily on internal "sudo()" calls, which would bypass this restriction. For this reason, checking "env.su" alone is not sufficient.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, but try to use an XML ID instead an id number anyway.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Comment thread project_create_restriction/security/security.xml Outdated
Comment thread project_create_restriction/readme/DESCRIPTION.md
@cgarcia-solvos cgarcia-solvos force-pushed the 17.0-add-project_create_restriction branch from 4900700 to e48b87b Compare January 19, 2026 16:23
Restrict project and task creation based on user groups
@cgarcia-solvos cgarcia-solvos force-pushed the 17.0-add-project_create_restriction branch from e48b87b to 4ca971b Compare January 19, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants