Hi Andrey,

I confirm Sergiu answer. As a matter of code style, in your case I would
probably put:
@Named(“raven”)
at the top of your component, and therefore
security.authorization.settler=raven
in xwiki.properties.

The pristine war from XWiki also contains a settler hinted “priority” and
implemented by the PrioritizingAuthorizationSettler class, if you have a
doubt with your ability for changing the configuration setting, it could be
a way to test it, and also a way to compare against your own customization.
Please note that this “priority” settler is experimental.
Regards,


On Mon, Apr 18, 2016 at 12:03 PM, abtv <[email protected]> wrote:

> I received the following error:
> 2016-04-18 12:46:11,599 [main] ERROR .o.i.DefaultObservationManager -
> Failed
> to lookup listeners
> org.xwiki.component.manager.ComponentLookupException: Failed to lookup
> component [role = [interface org.xwiki.observation.EventListener] hint =
> [default]]
>
> I implemented the following component:
>
> @Component
> @Named("MyAuthorizationSettler")
> @Singleton
> public class MyAuthorizationSettler implements AuthorizationSettler {
>
>     @Override
>     public SecurityAccessEntry settle(UserSecurityReference
> userSecurityReference, Collection<GroupSecurityReference> collection,
> Deque<SecurityRuleEntry> deque) {
>         System.out.println("settle");
>         System.out.println("name");
>         System.out.println(userSecurityReference.getName());
>         System.out.println("space name");
>
>
> System.out.println(userSecurityReference.getOriginalReference().getLastSpaceReference().getName());
>
>         return new SecurityAccessEntry() {
>             @Override
>             public UserSecurityReference getUserReference() {
>                 return userSecurityReference;
>             }
>
>             @Override
>             public SecurityAccess getAccess() {
>                 return null;
>             }
>
>             @Override
>             public SecurityReference getReference() {
>                 return null;
>             }
>         };
>     }
> }
>
> I added the folowing line
> 0:com.raven.xwiki.auth.RavenAuthorizationSettler
> to components.txt file.
>
> Then I added to xwiki.properties file the following line:
> security.authorization.settler=com.raven.xwiki.auth.MyAuthorizationSettler
>
> What should I need to implement else?
>
>
>
>
> --
> View this message in context:
> http://xwiki.475771.n2.nabble.com/What-is-the-right-way-to-implement-XWiki-custom-permission-check-in-java-code-tp7598878p7599032.html
> Sent from the XWiki- Dev mailing list archive at Nabble.com.
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
>



-- 
Denis Gervalle
SOFTEC sa - CEO
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to