Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

PermissionException when using RepositoryItemService

We put some initialization logic in method "activate()" of a service. And some specific repository items should be created in the initialization logic. But if we start RTC and create a connection using ADMIN account, PermisssionException will be thrown from RepositoryItemService.saveInCtx(). To solve this problem, we have to use TeamServiceContext to set the curent contributor as Contributor.ADMIN. But the TeamServiceContext is discouraged to use. So, my question is how to solve the permission exception issue without using TeamServiceContext?

0 votes



One answer

Permanent link
The short answer is "don't modify the repository in activate()". That
is the best answer and the only real solution to your problem. As you
point out, TeamServiceContext should not be used, and will likely be
removed or renamed in 2.0 (since it has been deprecated since 1.0).

The reason that activate() is not a good place to execute DB
modification is that it slows down the start up the server, and doesn't
provide the user with good feedback (or failure reporting). If
something fails in your activate() the failure will go to the server log
and will be hard for the user to diagnose. A better option is to
execute the modifications in the context of a user operation so that
errors can be reported back to the user in a nice way.

-
Matt Lavin
Jazz Server Team


On Mon, 2009-02-16 at 13:18 +0000, huangqf wrote:
We put some initialization logic in method "activate()" of a
service. And some specific repository items should be created in the
initialization logic. But if we start RTC and create a connection
using ADMIN account, PermisssionException will be thrown from
RepositoryItemService.saveInCtx(). To solve this problem, we have
to use TeamServiceContext to set the curent contributor as
Contributor.ADMIN. But the TeamServiceContext is discouraged to use.
So, my question is how to solve the permission exception issue without
using TeamServiceContext?

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Feb 16 '09, 8:12 a.m.

Question was seen: 4,880 times

Last updated: Feb 16 '09, 8:12 a.m.

Confirmation Cancel Confirm