Skip to content

Adding @Security annotation #132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Sep 27, 2019

Conversation

moufmouf
Copy link
Member

@moufmouf moufmouf commented Sep 20, 2019

The @Security annotation is meant to handle complex right cases not covered by @Logged or @right.

    /**
     * @Query()
     * @Security("secret=='foo'", message="Wrong secret passed")
     */
    public function getSecretPhrase(string $secret): string
    {
        return 'you can see this secret only if passed parameter is "foo"';
    }

TODO list:

  • Make arguments of the method accessible
  • Make current user accessible
  • Add functions to check rights (is_allowed?)
  • Think about a mechanism similar to Symfony voters
  • Proper documentation
  • Test / improve exception messages (if Security annotation fails to compile / execute)

@moufmouf moufmouf changed the title [WIP] Adding @Security annotation Adding @Security annotation Sep 27, 2019
@moufmouf moufmouf merged commit 744fb28 into thecodingmachine:master Sep 27, 2019
@moufmouf moufmouf deleted the security_annotation branch September 27, 2019 10:01
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.

1 participant