05-31-2007 11:13 AM
06-01-2007 04:52 AM
FacesContext facesContext = FacesContext.getCurrentInstance();
authService = (AuthorityService)facesContext.getApplication().getVariableResolver().resolveVariable(facesContext, "authorityService");
UserTransaction tx = null;
try {
FacesContext context = FacesContext.getCurrentInstance();
tx = Repository.getUserTransaction(context);
tx.begin();
authService.addAuthority(groupname, username);
tx.commit();
} catch (Throwable err) {
try {
if (tx != null) {
tx.rollback();
}
} catch (Exception tex) {
}
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
}Attention : il faut être connecter en admin pour pouvoir effectuer l'opération