Skip to Content

I came accross a question posted in the SDN forum asking if it was possible to restrict the viewing of iviews and pages during certain time of the day. I thought it was possible and through this blog I present what I find is a possible solution.

My solution is as follows.I create the iviews and put them into pages. The pages are attached to a role. The users are assigned or unassigned from the role based on how I wish to control the access. The assigning and unassigning of the users from the roles can be made dynamic using the IRole, IRoleFactory API’s.

For the sake of simplicity, I have created an iview which is assigned to the role “usr”. The user “sampleuser” is assigned to the role. By using the system time, I will assign or unassign the user from the role, inturn controlling the access to the page assigned to the role.

I will give the code samples here. Organise the following in the form of a Dyn Page. Export the project as a par file and create an iview out of the par file. Place the iview in the desktop inner page of the portal. You will have a page restrictor that will restrict the uasage of the pages between certain time period.

The following are the variables and conventions used

irole: Variable indicating Name of the role taken
iuser: Variable indicating User taken
roleiterator: Variable indicating Role Iterator. java.util.iterator
irolefactory: Variable indicating iRoleFactory
inTime: Boolean variable which is used to check if the current system time is within the restriction time
FlagLock: Integer variable indicating if the restriction is enforced or not. A value of 1 indicates no restriction and a value of 0 indicates a restriction.

The folowing imports are to be organised

The following methods are the methods for adding and removing a user into a role
public void addRole() – Method to add a user into a role
public void removeRole() – Method to remove a user from a role

The following method is the checking method which checks if the time is between a certain limit and returns a boolean. The checking method here is very simple. It can be modelled as complex as you might want. The section controller is added in the doProcessBeforeOutput section.

To report this post you need to login first.


You must be Logged on to comment or reply to a post.

  1. Hi,

    will this work for users that are logged on already?

    I assume that as long as the user does not refresh the browser window he still is able to access the page, right?


  2. Former Member Post author
    Hi vijai,
    I have tried your code, and i placed the created iview on desktop innerpage. but it is showing the error as could not create a iview.
    can please guide me to complete it successfully.
    1. Former Member Post author
      Rashmi, Which iView are you using? is it a standard portal iveiw/WebDynpro iView/a custom portal component? Also do you want to “Hide” the iView or merely “Disable” any user from making changes?
  3. Former Member
    Thanks for ur reply.
    I am using a standard portal iveiw BW report iView.
    Also i want to “Hide” or “Disable” this iView from all logon users for a particular time period daily.
    Thanks in advance.

Leave a Reply