'Check if (a) user can manage folder or (b) folder is accessible to user.
:param  folder:                  folder item
:type   folder:                  LibraryFolder
:param  check_manageable:        flag whether to check that user can manage item
:type   check_manageable:        bool
:param  check_accessible:        flag whether to check that user can access item
:type   check_accessible:        bool
:returns:   the original folder
:rtype:     LibraryFolder'

def secure(self, trans, folder, check_manageable=True, check_accessible=True):

    if trans.user_is_admin():
        return folder
    if check_manageable:
        folder = self.check_manageable(trans, folder)
    if check_accessible:
        folder = self.check_accessible(trans, folder)
    return folder
