Index: lams_central/src/java/org/lamsfoundation/lams/web/IndexAction.java =================================================================== diff -u -r27f58d007df3a168dc37fef184f15d6d65039e5f -rf68bae60ab4fe5a09f78b007cd1f2e15e026cd33 --- lams_central/src/java/org/lamsfoundation/lams/web/IndexAction.java (.../IndexAction.java) (revision 27f58d007df3a168dc37fef184f15d6d65039e5f) +++ lams_central/src/java/org/lamsfoundation/lams/web/IndexAction.java (.../IndexAction.java) (revision f68bae60ab4fe5a09f78b007cd1f2e15e026cd33) @@ -94,6 +94,10 @@ log.debug("we got "+organisations.size()+" organisations whose type is "+OrganisationType.COURSE_DESCRIPTION+" and whose state is "+OrganisationState.ACTIVE); roles.add(Role.ROLE_SYSADMIN); for (Organisation org:organisations) { + List userOrganisationRoles = service.getUserOrganisationRoles(org.getOrganisationId(),request.getRemoteUser()); + for(UserOrganisationRole userOrganisationRole:userOrganisationRoles){ + roles.add(userOrganisationRole.getRole().getRoleId()); + } orgBeans.add(createOrgBean(org, roles, request.getRemoteUser(),true)); } } else { @@ -104,6 +108,9 @@ for(Object userOrganisationRole:userOrganisation.getUserOrganisationRoles()){ roles.add(((UserOrganisationRole)userOrganisationRole).getRole().getRoleId()); } + for(Integer roleId:roles){ + log.debug("role:"+roleId); + } orgBeans.add(createOrgBean(userOrganisation.getOrganisation(),roles,request.getRemoteUser(),false)); } } @@ -121,16 +128,17 @@ links.add(new IndexLinkBean("Manage Classes", "admin/orgmanage.do?org=" + org.getOrganisationId())); } } - if (contains(roles, Role.ROLE_COURSE_ADMIN) || contains(roles, Role.ROLE_COURSE_MANAGER)) { + if (contains(roles, Role.ROLE_COURSE_ADMIN) || contains(roles, Role.ROLE_COURSE_MANAGER) || contains(roles,Role.ROLE_STAFF)) { if (orgBean.getType().equals(OrganisationType.COURSE_TYPE)) { - if(!isSysAdmin){ + if((!isSysAdmin)&&(contains(roles, Role.ROLE_COURSE_ADMIN) || contains(roles, Role.ROLE_COURSE_MANAGER))){ links.add(new IndexLinkBean("Manage Classes", "admin/orgmanage.do?org=" + org.getOrganisationId())); } links.add(new IndexLinkBean("Add Lesson", "home.do?method=addLesson&courseID=" + org.getOrganisationId())); }else{//CLASS_TYPE links.add(new IndexLinkBean("Add Lesson","home.do?method=addLesson&courseID="+org.getParentOrganisation().getOrganisationId()+"&classID="+org.getOrganisationId())); } } + orgBean.setLinks(links); List lessonBeans = new ArrayList(); @@ -139,7 +147,8 @@ List lessonLinks = new ArrayList(); if(contains(roles,Role.ROLE_COURSE_MANAGER)||contains(roles,Role.ROLE_STAFF)){ lessonLinks.add(new IndexLinkBean("Monitor", "home.do/method=monitorLesson&lessonID=" + lesson.getLessonId())); - }else if(contains(roles,Role.ROLE_LEARNER)){ + } + if(contains(roles,Role.ROLE_LEARNER)){ lessonLinks.add(new IndexLinkBean("Participate","home.do?method=learner&lessonID="+lesson.getLessonId())); } IndexLessonBean lessonBean = new IndexLessonBean(lesson.getLessonName(), lessonLinks);