Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Can not retrieve information from the passing parameters

Hi:
I am working on a web application of a database. JSPs provide the presentation logic, Java Servlets provide control to the flow of data, Java Beans do the actual data access to the database. Now I want to add an access control to it using aspectJ.

The accsss control code is like this:

---------------------------------------------------------------------------------------
package tables;

import java.io.*;
import java.util.*;

aspect AccessControl perthis(checkpoint(Vector))
{
pointcut checkpoint(Vector v): execution(public String project.insert(Vector)throws ClassNotFoundException) && args(v);

String around(Vector v): checkpoint(v)
{
  check the access availability, if true
    return proceed(v);
 otherwise,
   return "NotAllowed";
}
}
--------------------------------------------------------------------------------------

The problem is that when I do the access control, I need some user information like user's name, user's ID to determine the result. But I could not get such information from the passing parameters of method project.insert. I could add another parameter called say 'UserInfo' to the project.insert method in order to retrieve the user information. But this is not what I want. I do not want to touch any of the project.insert code. This will make Plugging and Unplugging the access control easily in the furture. The programmer of method project.insert does not even realize that the access control exists.

Is this possible? How to solve it?

Thanks in advance.

Lily

_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail



Back to the top