Exemplo n.º 1
0
    def get(self, collection_id):
        """Gets the editing rights for the given collection.

        Args:
            collection_id: str. ID for the collection.
        """
        (collection, collection_rights) = (
            collection_services.get_collection_and_collection_rights_by_id(
                collection_id))

        self.values.update({
            'can_edit':
            True,
            'can_unpublish':
            rights_manager.check_can_unpublish_activity(
                self.user, collection_rights),
            'collection_id':
            collection.id,
            'is_private':
            rights_manager.is_collection_private(collection_id),
            'owner_names':
            rights_manager.get_collection_owner_names(collection_id)
        })

        self.render_json(self.values)
Exemplo n.º 2
0
    def get(self, collection_id):
        """Handles GET requests."""
        (collection, collection_rights) = (
            collection_services.get_collection_and_collection_rights_by_id(
                collection_id))
        if collection is None:
            raise self.PageNotFoundException

        self.values.update({
            'can_edit':
            rights_manager.check_can_edit_activity(self.user,
                                                   collection_rights),
            'is_logged_in':
            bool(self.user_id),
            'collection_id':
            collection_id,
            'collection_title':
            collection.title,
            'is_private':
            rights_manager.is_collection_private(collection_id),
            'meta_name':
            collection.title,
            'meta_description':
            utils.capitalize_string(collection.objective)
        })

        self.render_template('pages/collection_player/collection_player.html')