public String getCustomUrlLabel(String id) throws IdUnusedException { UrlWrapper wrapper = (UrlWrapper) m_urls.get(id); if (wrapper == null) { throw new IdUnusedException(id); } return wrapper.getLabel(); }
public CitationCollection getCollection(String collectionId) throws IdUnusedException { CitationCollection edit = m_storage.getCollection(collectionId); if (edit == null) { throw new IdUnusedException(collectionId); } return edit; }
/** * @inheritDoc */ public Digest getDigest(String id) throws IdUnusedException { Digest digest = findDigest(id); if (digest == null) throw new IdUnusedException(id); return digest; }
public Citation getCitation(String citationId) throws IdUnusedException { checkForUpdates(); Citation citation = (Citation) m_citations.get(citationId); if (citation == null) { throw new IdUnusedException(citationId); } return citation; }
/** * Add prefix text to this URL? * @return true If the URL should get the prefix */ public boolean addPrefixToUrl(String id) throws IdUnusedException { UrlWrapper wrapper = (UrlWrapper) m_urls.get(id); if (wrapper == null) { throw new IdUnusedException(id); } return wrapper.addPrefix(); }
/** * Fetch a custom (direct) URL by ID. The URL prefix (if applicable) * is not added. * * @see org.sakaiproject.citation.api.Citation#getUnprefixedCustomUrl(java.lang.String) */ public String getUnprefixedCustomUrl(String id) throws IdUnusedException { UrlWrapper wrapper = (UrlWrapper) m_urls.get(id); if (wrapper == null) { throw new IdUnusedException(id); } return wrapper.getUrl(); }
/** * Check access to the collection with this local resource id. * * @param id * The id of the collection. * @exception IdUnusedException * if the id does not exist. * @exception TypeException * if the resource exists but is not a collection. * @exception PermissionException * if the user does not have permissions to see this collection (or read through containing collections). */ public void checkCollection(String id) throws IdUnusedException, TypeException, PermissionException { unlock(AUTH_RESOURCE_READ, id); ContentCollection collection = findCollection(id); if (collection == null) throw new IdUnusedException(id); } // checkCollection
/** * Return a specific channel. * * @param ref * The channel reference. * @return the MessageChannel that has the specified name. * @exception IdUnusedException * If this name is not defined for any channel. * @exception PermissionException * If the user does not have any permissions to the channel. */ public MessageChannel getChannel(String ref) throws IdUnusedException, PermissionException { MessageChannel c = findChannel(ref); if (c == null) throw new IdUnusedException(ref); // check security (throws if not permitted) unlock(SECURE_READ, ref); return c; } // getChannel
/** * Retrieves the current status of an assignment. * @param assignmentReference * @return * @throws IdUnusedException * @throws PermissionException */ public String getAssignmentStatus(String assignmentReference) throws IdUnusedException, PermissionException { M_log.debug(this + " GET ASSIGNMENT : REF : " + assignmentReference); // check security on the assignment unlockCheck(SECURE_ACCESS_ASSIGNMENT, assignmentReference); Assignment assignment = findAssignment(assignmentReference); if (assignment == null) throw new IdUnusedException(assignmentReference); return assignment.getStatus(); } // getAssignmentStatus
/** * Return a specific channel. * * @param ref * The channel reference. * @return the MessageChannel that has the specified name. * @exception IdUnusedException * If this name is not defined for any channel. * @exception PermissionException * If the user does not have any permissions to the channel. */ public MessageChannel getChannel(String ref) throws IdUnusedException, PermissionException { MessageChannel c = findChannel(ref); if (c == null) throw new IdUnusedException(ref); // check security (throws if not permitted) unlock(SECURE_READ, ref); return c; } // getChannel
/** * Return a specific channel. * * @param ref * The channel reference. * @return the MessageChannel that has the specified name. * @exception IdUnusedException * If this name is not defined for any channel. * @exception PermissionException * If the user does not have any permissions to the channel. */ public MessageChannel getChannel(String ref) throws IdUnusedException, PermissionException { MessageChannel c = findChannel(ref); if (c == null) throw new IdUnusedException(ref); // check security (throws if not permitted) unlock(SECURE_READ, ref); return c; } // getChannel
/** * Check access to the resource with this local resource id. For non-collection resources only. * * @param id * The id of the resource. * @exception PermissionException * if the user does not have permissions to read the resource or read through any containing collection. * @exception IdUnusedException * if the resource id is not found. * @exception TypeException * if the resource is a collection. */ public void checkResource(String id) throws PermissionException, IdUnusedException, TypeException { // check security unlock(AUTH_RESOURCE_READ, id); ContentResource resource = findResource(id); if (resource == null) throw new IdUnusedException(id); } // checkResource
/** * Access the collection with this local resource id. The collection internal members and properties are accessible from the returned Colelction object. * * @param id * The id of the collection. * @exception IdUnusedException * if the id does not exist. * @exception TypeException * if the resource exists but is not a collection. * @exception PermissionException * if the user does not have permissions to see this collection (or read through containing collections). * @return The ContentCollection object found. */ public ContentCollection getCollection(String id) throws IdUnusedException, TypeException, PermissionException { unlock(AUTH_RESOURCE_READ, id); ContentCollection collection = findCollection(id); if (collection == null) throw new IdUnusedException(id); // track event // EventTrackingService.post(EventTrackingService.newEvent(EVENT_RESOURCE_READ, collection.getReference(), false)); return collection; } // getCollection
protected Agent getRole(String username) throws IdUnusedException { String roleName; String siteId; int pos = username.lastIndexOf('/'); siteId = username.substring(0, pos); roleName = username.substring(pos + 1); Role role = null; AuthzGroup realm = null; try { realm = AuthzGroupService.getAuthzGroup(siteId); } catch (GroupNotDefinedException e) { throw new IdUnusedException (e.getId()); } if (realm != null) role = realm.getRole(roleName); if (role == null || realm == null) { return null; } return convertRole(role, realm); }
/** * Find the target resource reference string associated with this alias. * * @param alias * The alias. * @return The target resource reference string associated with this alias. * @throws IdUnusedException * if the alias is not defined. */ public String getTarget(String alias) throws IdUnusedException { // check the cache String ref = aliasReference(alias); BaseAliasEdit a = (BaseAliasEdit) m_storage.get(alias); if (a == null) throw new IdUnusedException(alias); return a.getTarget(); } // getTarget
/** * Access the Assignment with the specified reference. * * @param assignmentReference - * The reference of the Assignment. * @return The Assignment corresponding to the reference, or null if it does not exist. * @throws IdUnusedException * if there is no object with this reference. * @throws PermissionException * if the current user is not allowed to access this. */ public Assignment getAssignment(String assignmentReference) throws IdUnusedException, PermissionException { M_log.debug(this + " GET ASSIGNMENT : REF : " + assignmentReference); // check security on the assignment unlockCheck(SECURE_ACCESS_ASSIGNMENT, assignmentReference); Assignment assignment = findAssignment(assignmentReference); String currentUserId = SessionManager.getCurrentSessionUserId(); if (assignment == null) throw new IdUnusedException(assignmentReference); return checkAssignmentAccessibleForUser(assignment, currentUserId); }// getAssignment
protected Agent getAgentInternal(String username) throws IdUnusedException { if (username == null) { return null; } if (username.startsWith("/site/")) { return getRole(username); } User sakaiUser = null; try { sakaiUser = getDirectoryService().getUser(username); } catch (UserNotDefinedException e) { throw new IdUnusedException(e.getId()); } return morphAgent(sakaiUser); }
/** * @inheritDoc */ public void save(Site site) throws IdUnusedException, PermissionException { if (site.getId() == null) throw new IdUnusedException("<null>"); String siteRef = site.getReference(); if (!unlockCheck(SECURE_UPDATE_GROUP_MEMBERSHIP, siteRef) && !unlockCheck(SECURE_UPDATE_SITE_MEMBERSHIP, siteRef)) { // check security (throws if not permitted) unlock(SECURE_UPDATE_SITE, siteRef); } // check for existance if (!storage().check(site.getId())) { throw new IdUnusedException(site.getId()); } // Save the site doSave((BaseSite) site, false); }
/** * @inheritDoc */ public void unjoin(String id) throws IdUnusedException, PermissionException { try { authzGroupService().unjoinGroup(siteReference(id)); } catch (GroupNotDefinedException e) { throw new IdUnusedException(e.getId()); } catch (AuthzPermissionException e) { throw new PermissionException(e.getUser(), e.getFunction(), e.getResource()); } }
/** * Return a specific channel message, as specified by message name. * * @param messageId * The id of the message to get. * @return the Message that has the specified id. * @exception IdUnusedException * If this name is not a defined message in this channel. * @exception PermissionException * If the user does not have any permissions to read the message. */ public Message getMessage(String messageId) throws IdUnusedException, PermissionException { // check security on the message if (!allowGetMessage(getReference(), messageReference(getReference(), messageId))) { throw new PermissionException(m_sessionManager.getCurrentSessionUserId(), eventId(SECURE_READ), messageReference( getReference(), messageId)); } Message m = findMessage(messageId); if (m == null) throw new IdUnusedException(messageId); // track event // m_eventTrackingService.post(m_eventTrackingService.newEvent(eventId(SECURE_READ), m.getReference(), false)); return m; } // getMessage